Город МОСКОВСКИЙ
00:06:04

How To Create a BEGINNER Data Saving System using DataStore 2 // Roblox Scripting Tutorials // Ep.2

Аватар
Геймеры и Вдохновение
Просмотры:
35
Дата загрузки:
30.10.2023 00:14
Длительность:
00:06:04
Категория:
Видеоигры

Описание

This video teaches you how to make a beginner data storage system using DataStore2 which will save your stats across games and is used in almost every popular Roblox game today!

DataStore2:

https://github.com/Kampfkarren/Roblox/releases/tag/ds2-1.3.0

Open Source Game:

https://www.roblox.com/games/11941204656/Source-DS2-Game

Core Script:

local DS2 = require(script.DataStore2)

DS2.Combine(
"MasterKay",
"Coins",
"Rebirths"
)

game.Players.PlayerAdded:Connect(function(plr)
local ls = Instance.new("Folder")
ls.Name = "leaderstats"
ls.Parent = plr

local Coins = Instance.new("NumberValue")
Coins.Name = "Coins"
Coins.Parent = ls

local Rebirths = Instance.new("NumberValue")
Rebirths.Name = "Rebirths"
Rebirths.Parent = ls

if DS2("Coins",plr):Get() ~= nil then
Coins.Value = DS2("Coins",plr):Get()
else
Coins.Value = 250 -- STARTING VALUE
end

if DS2("Rebirths",plr):Get() ~= nil then
Rebirths.Value = DS2("Rebirths",plr):Get()
else
Rebirths.Value = 0 -- STARTING VALUE
end

Coins.Changed:Connect(function()
DS2("Coins",plr):Set(Coins.Value)
end)

Rebirths.Changed:Connect(function()
DS2("Rebirths",plr):Set(Rebirths.Value)
end)
end)



local RS = game:GetService("ReplicatedStorage")
local TS = game:GetService("TweenService")

RS.WideEvent.OnClientEvent:Connect(function(text)
script.Parent.Text = text
script.Parent.Visible = true
TS:Create(script.Parent,TweenInfo.new(0.5),{BackgroundTransparency = 0.4}):Play()
TS:Create(script.Parent,TweenInfo.new(0.5),{TextTransparency = 0}):Play()
wait(5)
TS:Create(script.Parent,TweenInfo.new(0.5),{BackgroundTransparency = 10.4}):Play()
TS:Create(script.Parent,TweenInfo.new(0.5),{TextTransparency = 1}):Play()
script.Parent.Visible = false
end)

#roblox #robloxstudio #tutorial #tutorials #helping #system #systems #server #message #notification #robloxtutorial #robloxtutorials #robloxtrend

Рекомендуемые видео