Normal Script the one that fires the remote event
local TimerStart = Instance.new("RemoteEvent") TimerStart.Parent = game.ReplicatedStorage TimerStart.Name = "TimerStart" function onTouch() print("working") TimerStart:FireClient() end script.Parent.Touched:connect(onTouch)
local script the one that runs the timer
local time = 0 local function TimerStart() print("working2") script.Parent.Parent.TextLabel.Text = 0 for i = 1, 9999 do wait(0.1) time = time + 0.1 script.Parent.Parent.TextLabel.Text = tostring(time) end end
Heres the new updated local script
local time = 0 local function TimerStart() print("working2") script.Parent.Parent.TextLabel.Text = 0 for i = 1, 9999 do wait(0.1) time = time + 0.1 script.Parent.Parent.TextLabel.Text = tostring(time) TimerStart.OnClientEvent:Connect(TimerStart) end end
Looks like you're missing an OnClientEvent
in your Local Script. Should also rename your event so it's not the same as your function.
Local Script
TimerStart.OnClientEvent:Connect(TimerStart)
Also, specify which client to start the timer. Server Script
TimerStart:FireClient(player)
Here is what you should have:
Local Script
local event = game:GetService("ReplicatedStorage"):WaitForChild("TimerStart") local time = 0 local function TimerStart() print("working2") script.Parent.Parent.TextLabel.Text = 0 for i = 1, 9999 do wait(0.1) time = time + 0.1 script.Parent.Parent.TextLabel.Text = tostring(time) end end event.OnClientEvent:Connect(TimerStart)
Server Script
local TimerStart = Instance.new("RemoteEvent") TimerStart.Parent = game.ReplicatedStorage TimerStart.Name = "TimerStart" function onTouch(hit) print("working") local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player then TimerStart:FireClient(player) end end script.Parent.Touched:Connect(onTouch)