Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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)

2 comments

0

you have the load script too? because if you only change the save script, dont will work when you load

0

Then how would i modify it so it works properly?

1 answer

try duplicate this script and configurate he to the other boolvalue

This discussion is preserved as it was. New answers, comments, and votes are closed.