01 | local x = game.Workspace.tpReceive.Position.X |
02 | local y = game.Workspace.tpReceive.Position.Y |
03 | local z = game.Workspace.tpReceive.Position.Z |
04 |
05 | function 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 |
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! :)
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!