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

Save/load system not changing text of GUI?

I'm trying to make a Save/load system. When I play my game and press "Save" it doesn't even change the text of the GUI, I've checked the output and it says nothing. It's not a localscript. When I play in roblox studio it changes the text.

local Debounce = false
local player = script.Parent.Parent.Parent.Parent
local Save = script.Parent.Save
local Load = script.Parent.Load

Save.MouseButton1Click:connect(function()
	if Debounce == false then
		Debounce = true
		Save.Text = "Saving..."
		player:WaitForDataReady()
		player:SaveBoolean("Sphere1",player.Sphere1.Value)
		Save.Text = "Saved!"
		wait(1)
		Save.Text = "Save"
		Debounce = false
	end
end)

Load.MouseButton1Click:connect(function()
	if Debounce == false then
		Debounce = true
		Load.Text = "Loading..."
		player:WaitForDataReady()
		player.Sphere1.Value = player:LoadBoolean("Sphere1")
		if player.LoadBoolean("Sphere1") == true then
			--has 1 sphere
		end
		Load.Text = "Loaded!"
		wait(1)
		Load.Text = "Load"
		Debounce = false
	end
end)

1 answer

Your issue is probably that you attempt to acces the save and load button before they're replicated to the Client (The player)

To fix this simpfully add

local Save = script.Parent:WaitForChild("Save")
local Load = script.Parent:WaitForChild("Load")

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