Touched events on client

Hello! I wanted to create a speed boost pad that when touched, will apply a force on the player who touched it. However, I want the touched event to be handled on the client for a smoother experience (no point handling it on the server, clients have complete control over their character). However, when I inserted a local script inside the speed boost pad, the touch event was never fired, even when I touch it. How can I fix this without handling the touch event from the character’s body parts?

1 Like

LocalScripts do not run under Workspace. You’d be better off using the Touched event of the Humanoid and just detect if the touched part is a valid speed boost

you would put the script in startergui or starterpack then specify the speed part and then just do the touched function, although a server script is a way better approach.

I wouldn’t suggest handling that on the client, it could cause issues with exploiters in the future.

But if you really need to, you can change Script.RunContext to client. No need for LocalScripts.


Best regards,
Pinker

1 Like

LocalScript doesn’t work in workspace; only you can put them in StarterPlayerScripts or StarterGui.

My game is focused on parkour, so I’d rather optimise the experience of players since exploiters have full control over their character, kind of defeating the purpose of using server scripts.

What’s the difference between a local script and a server script with its run context set to client? Your solution works, but I don’t understand why it’s different.

Fair enough, if you think it doesn’t matter, then it’s fine.


LocalScripts can only run in these locations, and after being replicated to the client.

So for example, if you took a Script with RunContext client and put it in StarterGui, it will run in StarterGui and the player’s PlayerGui. A LocalScript will only run in the PlayerGui.

Otherwise they’re identical.


I found the original post, but that doesn’t have a source for this information.

Either way, I don’t believe this is the reason as to why LocalScripts only run in specific locations since you can do that with RunContext Client. To me it seems more like a legacy thing.


Best regards,
Pinker