I guess my problem is that my script can't connect with the client.
Load:
function loadScore(plyr, clickCounter)
local score = plyr:LoadNumber("stage")
if not score == 0 then
clickCounter.Value = score
else
print("Nothing to load../..score was 0")
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))
player.leaderstats:findFirstChild(script.Parent.Parent.Parent.Configuration.Type.Value).Value = player:LoadNumber("stage")
m = Instance.new("Message",player.PlayerGui)
m.Text = script.Parent.Parent.Parent.Configuration.Type.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)
Save:
function SaveScore(plyr, stage)
plyr:SaveNumber("stage", stage)
end
function onClicked()
player = script.Parent.Parent.Parent.Parent.Parent
player:WaitForDataReady()
if player.DataReady == true then
SaveScore(player, player.leaderstats:findFirstChild(script.Parent.Parent.Parent.Configuration.Type.Value).Value)
m = Instance.new("Message",player.PlayerGui)
m.Text = script.Parent.Parent.Parent.Configuration.Type.Value.. " saved!"
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)
Layout: http://prntscr.com/f0o5fr
