I have a few questions to help diagnose the issue:
Are you using a Script or a LocalScript?
Where is this code located in the explorer?
Another thing to note is that when editing the player’s GUIs, you should be using PlayerGui, not ScreenGui, which is a common mistake (one that I used to make too).
Also, what exactly are you trying to achieve? Do you want the timer to go away on everyones screen when one player reaches the finish line? Or maybe, the timer only goes away once the individual player reaches the end?
For the latter, you can try using a LocalScript like this, under StarterPlayer → StarterPlayerScripts:
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local finishLine = workspace:WaitForChild("FinishLine")
local counter = playerGui:WaitForChild("Counter")
local function onTouched(hit)
if hit.Parent and not hit.Parent:FindFirstChild("Humanoid") then
return
end
local playerHit = Players:GetPlayerFromCharacter(hit.Parent)
if playerHit ~= player then
return
end
counter.Frame.Visible = false
counter.Frame2.Visible = false
counter.TextLabel.Visible = false
end
-- Events
finishedLine.Touched:Connect(onTouched)