When I added a script, the rest broke, can you fix it?
Asked by
4 years ago Edited 4 years ago
Hi there!
I'm making a game where the players points update by one every second. I need the points to start updating only when the player steps on a model, called "Game." Here is my script, which doesn't work.
Can you fix it?
01 | local Players = game:GetService( "Players" ) |
02 | local UpdatePoints = false |
03 | local function onTouch(part) |
06 | part.Touched:Connect(onTouch) |
07 | Players.PlayerAdded:Connect( function (Player) |
08 | Player.CharacterAdded:Connect( function (Character) |
11 | local Leaderstats = Instance.new( "Folder" ) |
12 | Leaderstats.Name = "leaderstats" |
13 | Leaderstats.Parent = Player |
15 | local Points = Instance.new( "IntValue" ) |
16 | Points.Name = "Points" |
17 | Points.Parent = Leaderstats |
19 | Player.leaderstats.Points.Value = 0 |
21 | local Humanoid = Character.Humanoid |
22 | Humanoid.Died:Connect( function () |
24 | Player.leaderstats.Points.Value = 0 |
27 | while (UpdatePoints) do |
29 | Player.leaderstats.Points.Value + = 1 |
30 | if not (UpdatePoints) then |