Every single time I click ANYWHERE AT ALL in my cart ride game, it pops up with "attempt to call a nil value - Client", and it completely cancels out my tool.activated functions (ive tried removing the tool.activated function btw) I used CTRL + SHIFT + F to look for any click functions or mouse functions that could be causing this, but there is nothing. I don't know why this is happening. I've searched everywhere, and I've checked the server for errors. Someone please help.
It could either mean there's a typographical errros or you didn't use :WaitForChild()
in local scripts. Keep in mind that you should use Instance:WaitForChild(Child)
instead of Instance:FindFirstChild(Child)
or Instance.Child
when using local scripts.
This is because local scripts loads faster than the game itself. Meaning when local scripts run, everything in the server like the workspace, the players, GUIs, etc. doesn't exist yet until the server finally loads.
Wrong:
-- local script local StringValue = workspace.StringValue print(StringValue.Value)
Correct:
-- local script local StringValue = workspace:WaitForChild("StringValue") -- pauses the script waits for "StringValue" to exist in the workspace print(StringValue.Value)