01 | script.Parent.Parent.Parent.Touched:connect( function (hit) |
02 | if hit.Parent:FindFirstChild( "Humanoid" ) then |
03 | local plr = game.Players:GetPlayerFromCharacter(hit.Parent) |
04 | end |
05 | end ) |
06 | for i = 5 , 1 , - 1 do |
07 | script.Parent.Text = i |
08 |
09 | print ( "Done" ) |
10 | end |
https://gyazo.com/acc8aaca229a2730f0a1a075f3450fc5
Hi this ring is supposed to countdown from 5 whenever touched by the player but it fires 5 times and shows nothing on the billboard GUI text. Can someone help me with this
enclose the for loop inside the touched and add a var that checks it
01 | bool = false |
02 | script.Parent.Parent.Parent.Touched:Connect( function (hit) |
03 | if hit.Parent:FindFirstChildOfClass( "Humanoid" ) or hit.Parent.Parent:FindFirstChildOFClass( "Humanoid" ) and not bool then bool = true |
04 | local plr = game.Players:GetPlayerFromCharacter(hit.Parent) |
05 |
06 | for i = 5 , 1 , - 1 do |
07 | script.Parent.Text = i |
08 |
09 | print ( "Done" ) |
10 | end |
11 | end |
12 | end ) |