Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Load script
- 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 script
- function SaveScore(plyr, score)
- plyr:SaveNumber("stage", score)
- 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)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement