Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to not lose points on death?

Asked by 9 years ago
01local x = game.Workspace.tpReceive.Position.X
02local y = game.Workspace.tpReceive.Position.Y
03local z = game.Workspace.tpReceive.Position.Z
04 
05function onTouched(hit)
06    local player = game.Players:GetPlayerFromCharacter(hit.Parent)
07    if player then
08        local gui = player.PlayerGui.PointsGui.PointsFrame.Points
09        local number = tonumber(gui.Text)
10        if number == nil then number = 0
11        end
12        number = number+1
13        gui.Text = number
14        wait()
15        for i, object in pairs(game.Workspace:GetChildren()) do
View all 31 lines...

Thats the script I have right now, but whenever I reset or fall off the cliff, my character loses all of their points, how do I fix this? Thanks a million guys! :)

1 answer

Log in to vote
0
Answered by
8391ice 91
9 years ago

You have stored the points in the player's GUI; unfortunately, values in the PlayerGUI will reset if a player dies or resets. It would be better for you to store the points in a leaderboard, because the points will then remain the same even after a player's death.

If you'd like to know how to create a leaderboard, it's really rather simple; here's a link to a Wiki article for it.

http://wiki.roblox.com/index.php?title=Leaderboard

Hope this helps!

Ad

Answer this question