How do I make the timer start when not touching a certain part?
I'm making a game with a script THAT CHANGES THE PLAYERS SCORE EVERY SECOND, AND RESETS BACK TO ZERO WHEN THE PLAYER DIES. This works fine. However, I need the timer to only start when the player isn't touching a certain part (Called "StartPart"). I still need to keep the same aspects of the script I meantioned aboye (In CAPITALS).
Heres the script I have currently:
01 | local Players = game:GetService( "Players" ) |
02 | local UpdatePoints = false |
04 | Players.PlayerAdded:Connect( function (Player) |
05 | Player.CharacterAdded:Connect( function (Character) |
08 | local Leaderstats = Instance.new( "Folder" ) |
09 | Leaderstats.Name = "leaderstats" |
10 | Leaderstats.Parent = Player |
12 | local Points = Instance.new( "IntValue" ) |
13 | Points.Name = "Points" |
14 | Points.Parent = Leaderstats |
16 | Player.leaderstats.Points.Value = 0 |
18 | local Humanoid = Character.Humanoid |
19 | Humanoid.Died:Connect( function () |
21 | Player.leaderstats.Points.Value = 0 |
24 | while (UpdatePoints) do |
26 | Player.leaderstats.Points.Value + = 1 |
27 | if not (UpdatePoints) then |