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

How to Save a Bool Values. in a local player?

Hello so i am near to finish my shop gui but its still needs one thing i trying to find where and how to save boolvalues in local player maybe someone can say me? Thank you.

2 answers

local ds = game:GetService("DataStoreService")
local bool = ds:GetDataStore("BoolSaving")

game.Players.PlayerAdded:Connect(function(plr)
    local boolValue = Instance.new("BoolValue")
    boolValue.Parent = plr
    boolValue.Name = "BoolValue"

    boolValue.Value = bool:GetAsync(plr.UserId) or false
end)

game.Players.PlayerRemoving:Connect(function(plr)
    bool:SetAsync(plr.UserId, plr.BoolValue.Value)
end)

This will create a BoolValue and save it when the player leaves

6 comments

0

its dont saves? that its true..

0

If you test it in-game it will work, since you dont leave the game in studio

0

kk ill see

0

kk il try leaving game from studio and trying it play in roblox game engine

0

still not woks i need to repurchase every time i cope to server again and its dont save that still..

0

TEST IT IN-GAME, NOT IN ROBLOX STUDIO

dont works i dont know why.

1 comment

0

i made that if buy button will be clicked it gives bool value true then if player connects with bool value true its needs to show a equip button not buy see its dont save a true bool value.?

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