I have a script that should activate on an event, but it returns an error

attempt to index a nil value 'OnClientEvent'

Here's the script

local timeout = 0.25
local timerEvent = script.Parent:FindFirstChild("Timer")
local timerReturnEvent = script.Parent:FindFirstChild("TimerReturn")

timerEvent.OnClientEvent:Connect(function(player) --Error Here
	wait(timeout)
	timerReturnEvent:FireServer()
end)

3 comments

0

Is it a server script?

0

Or, is there another item within the parent called "Timer", if so, change it to your corresponding remote.

0

It's inside of a tool, I have tried changing the way I define Event