Hi ! I have a question, Is it possible to do a “local” touch function?
Yes it is possible if you put the local script in the player, but script functions are better to use.
What do you mean in player?, in Character ?
By player I mean putting the local script in the StarterPack. I would divide them into folders so it will be easy to find.
Touch events is already handled locally, but to answer your question: yes, you use a localscript.
Touch events are handled through scripts inside of the part which doesn’t make it local unless you use server fires and etc.
Put it in starterplayerscripts.
You don’t make any sense.
Touched events is handled locally to avoid latency, which means a exploiter can stand somewhere else, but on their screen, they are actually somewhere else touching a part and can trigger the event.
yes but for example, if a player touches a part, then it will turn red, but other players will see it red as well
Then use a server-script, as that does not replicate to other clients if it is a localscript.
Read more about replication on the Roblox API.
You must’ve just started scripting. If a player touches a block and it prints the amount of times the block was touched everyone is going to see it. That’s why there is a difference between local scripts and scripts.
If this is a serverscript:
Changes being made is replicated to other clients.
If this is a localscript:
Changes is not replicated to the server, nor other clients unless you use FireAllClients / FireServer in order to replicate it.
I’m sorry if you’re having a bad time understanding, please read before you post.
Exactly. But you said touch events are local. But if you were to put a touched event in a script it wouldn’t be local.
I later saw that it did not make sense and should have reformated it, however if you read it closely it does make sense.
The ACTUAL event is handled locally, that is what I’m saying.
Well agree to disagree I guess. Have a nice day!
Touch events ARE handled locally.
There is a difference between being handled and being local.
When a client touches a part with a TouchInterest, That client says “Hey, I touched this part”, and the touch gets fired to the server to handle any connections made on the server.
This same practice gets applied to ClickDetectors, the client says “I clicked the part”, it gets fired to the server, and the server fires any RBXScriptSignals connected to the .Clicked event.
If you want I can show some proof of this in play?
Well really depends. Some parts won’t have touch interest if you don’t give it one. I mean at the end of the day everyone sees things differently, but usually when I use touch scripts without finding the specific plr it sends to everyone in the server.