So, I'm trying to make a GUI only appear once the first time you ever play the game. I made a script like this before, but its been a VERY long time, and the script I built is just very loosely based off of what I remember (which is no surprise that it doesn't work). The main problem is that the wiki that I learned how to save and load off of has been removed and replaced with a page that is very vague, and doesn't explain much. Here is my script:
game.Players.PlayerAdded:connect(function(player) if player:WaitForDataReady() then local load = game.Players:LoadString("Read") if load ~= true then script.Parent.Parent:Clone().Parent = game.Players.LocalPlayer.PlayerGui game.Players:SaveString("Read", true) end end end)
This script is in the GUI itself.
Like I said, I know this is wrong, and its probably way wrong. So, along with an answer, I'd appreciate it if someone could also give a short tutorial on how to use Save and Load with String, Boolean, etc. because, like I said, there doesn't seem to be very good wikis/tutorials out there.
A few things wrong with your code:
1) You are trying to load a String
from Players
service instead of the actual player in line 3. It should be more like this:
local load = player:LoadString("Read")
2) You are trying to save a boolean
value inside of a required String
parameter. You have to put in a String
. Perhaps do it like this?
game.Players:SaveString("Read", "yes")
...and then when you want to check it:
if load ~= "yes" then
Other than that, everything else looks right at a glance. Let me know if you're still experiencing problems.