Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i add another boolvalue that saves to this datastore script?

Asked by 6 years ago
Edited 6 years ago

How would i make this datastore script save another BoolValue?

local DataStore = game:GetService("DataStoreService")

local ds = DataStore:GetDataStore("BoolValueSaves")

game.Players.PlayerAdded:Connect(function(player)

local leader = Instance.new("Folder",player)
leader.Name = "BoolValues"

local bs = Instance.new("BoolValue",leader)
bs.Name = "Gift"

bs.Value = ds:GetAsync(player.UserId) or false

ds:SetAsync(player.UserId, bs.Value)

bs.Changed:Connect(function()

    ds:SetAsync(player.UserId, bs.Value)

end)

game.Players.PlayerRemoving:Connect(function(player)

        ds:SetAsync(player.UserId, player.BoolValues.Gift.Value)

    end)
end)
0
you have the load script too? because if you only change the save script, dont will work when you load darkzerobits 92 — 6y
0
Then how would i modify it so it works properly? SamthekidRSsl 58 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

try duplicate this script and configurate he to the other boolvalue

Ad

Answer this question