Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Hey der! I just owned whoever gave RME his DP script for DoD! :DD
- --Here is the script RME got:
- function saveScore1(player, score1)
- player:SaveNumber("Level", score1)
- end
- function saveScore2(player, score2)
- player:SaveNumber("XP", score2)
- end
- function saveScore3(player, score3)
- player:SaveNumber("Gold", score3)
- end
- function loadScore1(player, money)
- local score1 = player:LoadNumber("Level")
- local stats = player:FindFirstChild("leaderstats")
- if (stats ~= nil) then
- local money = stats:FindFirstChild("Level")
- money.Value = score1
- end
- end
- function loadScore2(player, gold)
- local score2 = player:LoadNumber("XP")
- local stats = player:FindFirstChild("leaderstats")
- if (stats ~= nil) then
- local gold = stats:FindFirstChild("XP")
- gold.Value = score2
- end
- end
- function loadScore3(player, three)
- local score3 = player:LoadNumber("Gold")
- local stats = player:FindFirstChild("leaderstats")
- if (stats ~= nil) then
- local three = stats:FindFirstChild("Gold")
- three.Value = score3
- end
- end
- function onPlayerEntered(newPlayer)
- if newPlayer:findFirstChild("leaderstats") ~= nil then
- newPlayer.leaderstats:remove()
- end
- local stats = Instance.new("IntValue")
- stats.Name = "leaderstats"
- stats.Parent = newPlayer
- expinsert = Instance.new("IntValue")
- expinsert.Parent = stats
- expinsert.Name = "Level"
- expinsert.Value = 0
- goldinsert = Instance.new("IntValue")
- goldinsert.Parent = stats
- goldinsert.Name = "XP"
- goldinsert.Value = 0
- threeinsert = Instance.new("IntValue")
- threeinsert.Parent = stats
- threeinsert.Name = "Gold"
- threeinsert.Value = 0
- print"waiting for data to be ready"
- newPlayer:WaitForDataReady()
- loadScore1(newPlayer, money)
- loadScore2(newPlayer, gold)
- loadScore3(newPlayer, three)
- end
- function onPlayerRemoving(player)
- print("Attempting to save score for " .. player.Name)
- if player.DataReady == true then
- local stats = player:FindFirstChild("leaderstats")
- if (stats ~= nil) then
- local money = stats:FindFirstChild("Level")
- if (money ~= nil) then
- saveScore1(player, money.Value)
- print("saved money")
- end
- local gold = stats:FindFirstChild("XP")
- if (gold ~= nil) then
- saveScore2(player, gold.Value)
- print("saved gold")
- end
- end
- local gold = stats:FindFirstChild("Gold")
- if (three ~= nil) then
- saveScore3(player, three.Value)
- end
- end
- end
- end
- game.Players.PlayerAdded:connect(onPlayerEntered)
- game.Players.PlayerRemoving:connect(onPlayerRemoving)
- --EWWW MESSEH!!! Also, over 100 lines.
- --Here's what I gave him back (He asked me to look over the above script)
- game.Players.PlayerAdded:connect(function(p)
- s = Instance.new("IntValue",p)
- l,x,g = Instance.new("IntValue",s),Instance.new("IntValue",s),Instance.new("IntValue",s)
- l.Name,x.Name,g.Name = "Lvl","XP","Gold"
- p:WaitForDataReady()
- l.Value,x.Value,g.Value = p:LoadNumber("Lvl"),p:LoadNumber("XP"),p:LoadNumber("Gold")
- l.Changed:connect(function()
- p:SaveNumber("Lvl",l.Value)
- end)
- x.Changed:connect(function()
- p:SaveNumber("XP",x.Value)
- end)
- g.Changed:connect(function()
- p:SaveNumber("Gold",g.Value)
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement