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

My Timer billboard isnt working? HELP

Asked by
Coder_1 27
5 years ago
01script.Parent.Parent.Parent.Touched:connect(function(hit)
02    if hit.Parent:FindFirstChild("Humanoid") then
03      local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
04    end
05end)
06for i = 5, 1, -1 do
07    script.Parent.Text = i
08 
09   print("Done")
10end

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

1 answer

Log in to vote
1
Answered by 5 years ago

enclose the for loop inside the touched and add a var that checks it

01bool=false
02script.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 
06for i = 5, 1, -1 do
07    script.Parent.Text = i
08 
09   print("Done")
10end
11end
12end)
0
Will that do a countdown from 5 Coder_1 27 — 5y
Ad

Answer this question