Hello, I have problem with save/load gui, becouse it should save and load correct number. Scripts work, but if i click load points value is the same like checkpoints value...

Here is script from load:

function loadScore(plyr, clickCounter)

	local score = plyr:LoadNumber("Points")
	local sc = plyr:LoadNumber("Checkpoints") 

	if not score == 0 then
		clickCounter.Value = score
	else
		print("Nothing to load../..score was 0")
		
	if not sc == 0 then
		clickCounter.Value = sc
	else
		print("Nothing to load../..score was 0")
		end
	end

end



function onClicked()

	player = script.Parent.Parent.Parent.Parent.Parent
		player:WaitForDataReady()
if player.DataReady == true then
loadScore(player, player.leaderstats:findFirstChild(script.Parent.Parent.Parent.Configuration.Type.Value))
loadScore(player, player.leaderstats:findFirstChild(script.Parent.Parent.Parent.Configuration.Type1.Value))
player.leaderstats:findFirstChild(script.Parent.Parent.Parent.Configuration.Type.Value).Value = player:LoadNumber("Points")
player.leaderstats:findFirstChild(script.Parent.Parent.Parent.Configuration.Type1.Value).Value = player:LoadNumber("Checkpoints")
m = Instance.new("Message",player.PlayerGui)
m.Text = script.Parent.Parent.Parent.Configuration.Type.Value.. " & "..script.Parent.Parent.Parent.Configuration.Type1.Value.. " loaded!"
script.Parent.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0
game:service("Debris"):AddItem(m, 3)
else
m = Instance.new("Message",player.PlayerGui)
m.Text = "Wait until DataReady!"
game:service("Debris"):AddItem(m, 3)
end
end 

script.Parent.MouseButton1Click:connect(onClicked)

I know script is large, but i think there is maybe in few lines mistake. Save script is same like this only begin is another, so if someone help me fix load script i'll fix save script.

5 comments

0

You should really use DataStores e.e

0

Can you tell me how?

0

Umm... So maybe can you change my script? Im scripting beginner and i don't know how to use DataStores...

0

Ugh.. i tried to use DataStore, but i don't know how... script don't work ;/