Trying to save a boolvalue in a datastore

If you are testing in studio, note if you are using test in studio and you end then do leave in studio and the session ends, it is not reliable. Most of the time the studio will not wait for that to be done before stopping the simulation. In the case of a player leaving a server, the server is given time before shutdown even if the player who left is the last player. That is not the case when you leave in a studio simulation

Roblox just went down for me so I cant test right now I will let you know when I have tested

Alright, but also remember to do it in ROBLOX and not studio, as it can be very unreliable like @Hypnotails has said.

Not just you. My studio crashed and I think I just lost 2 hours of work… uhhhh…

Yikes, seems like roblox studio just died for a lot of people.

Right as you say that roblox comes back up. Are you a wizard?

No. Just guess I have good timing.

image

Why have the value stored in the player though? If it is used as a tag to determine of the player is banned. You might be better off saving this in a table similar to this:

Watever={}
—a player joins:
Add a key-value of the player and if they are banned to table, getting the value from data store

—a player leaves
Save the value of that player that is found in the table, then delete that entry from the table

That looks like it’s being ran in studio. Are you sure you’re in a ROBLOX game and not testing it through ROBLOX studio?

This script if clicked will change the value to true right?

script.Parent.MouseClick:Connect(function()

game.Players.LocalPlayer.BoolValue.Value = true

end)

As he said, you should be testing that saving on close in client rather than studio. Studio is unreliable for saving I’d you stop the simulation while saving

If that code above in the game would work to change the value to true then it doesn’t work

That is wrong though. I see what you did there

You see, you are asking the local player to change the value
That value change will likely not replicate to the server
For the sever, the value did not change

How do I fix it though? If you could tell me

You’d have to run a script like this for it to change the value.

script.Parent.ClickDetector.MouseButton1Click:Connect(function(player)

player:FindFirstChild("BoolValue").Value = true

end)

You should be making sure that the server is changing the value. If the script is a local script, you could instead use a remote event to tell a script on the server to change the value for the client

Just tried that and it didn’t work I looked in the output for any errors while clicking and none were found

When you say it didn’t work, do you mean the value didn’t change or you didn’t get kicked?

Never got kicked when I rejoined.