local start = game.Workspace:FindFirstChild("Start")
local endPart = game.Workspace:FindFirstChild("End")
local textlabel = script.Parent
local finished = script.Parent.finished
local function timer()
for t = 0,math.huge,0.05 do
wait(0.0499999999)
if finished.Value == true then break end
local stringT = tostring(t)
if #(tostring(t)) == 3 then
t = t.."0"
elseif #(tostring(t)) == 1 then
t = t..".00"
end
textlabel.Text = tostring(t)
end
end
start.Touched:Connect(function(hit)
if not game.Players:GetPlayerFromCharacter(hit.Parent) then return end
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local character = hit.Parent
timer()
end)
endPart.Touched:Connect(function(hit)
finished.Value = true
wait(0.3)
finished.Value = false
end)
the code on top is for a timer. the timer starts when the players touches the "start" part and ends when player touches the "end" part
this is in a local script but for some reason the timer runs for every players, meaning globally. im confused, why is this running globally and not locally even though its a local script
local script is in StarterGui>ScreenGui>TextLabel>Localscript
any help is greatly appreciated!
