At first the the BoolValue's value is false and without changing its property it changes to true.
game.Players.PlayerAdded:connect(function(player) local Folder = Instance.new("Folder",player) Folder.Name = "BoolValues" local bool = Instance.new("BoolValue",player.BoolValues) bool.Value = false bool.Name = "BoolTest" local ds = game:GetService("DataStoreService"):GetDataStore("user"..player.userId) local DataLoaded = ds:GetAsync("Test") if DataLoaded == nil then DataLoaded = ds:SetAsync('Test',true) end bool.Value = DataLoaded end)
Read kingdom5 comments first before reading this answer. You need to create a key
per user, not a datastore per user. Thats too much. Example:
local DataStore = game:GetService("DataStoreService") local ds = DataStore:GetDataStore("BoolValueSaves") --we are creating a datastore, and inside the datastore we create a key, which is basically a folder holding each players data. game.Players.PlayerAdded:Connect(function(player) local leader = Instance.new("Folder",player) leader.Name = "BoolValues" local bs = Instance.new("BoolValue",leader) bs.Name = "BoolTest" bs.Value = ds:GetAsync(player.UserId) or false --when the player joins, it searches the datastore for the player's key. if nothing was found, the value is set to false until the value is changed. when it's changed, it gets saved. ds:SetAsync(player.UserId, bs.Value) --this is how you do it bs.Changed:Connect(function() --when the value is changed, ds:SetAsync(player.UserId, bs.Value) --update the value end) game.Players.PlayerRemoving:Connect(function(player) ds:SetAsync(player.UserId, player.BoolValues.BoolTest.Value) --save the value when the player leaves. end)
Hopefully I explained this good enough. If this helped PLEASE accept my answer!