Hi! I’ll get straight to the point. I’m trying to make a minigame similar to Survivors where if you click and your stick is touching another player, that player will sit. Here is an Example
I tried to make some code that I assumed would work but sadly it doesn’t, I’m not sure what is wrong with it but I’m not too advanced in scripting so . How would you all go about it? This is my code, it is inside of the Roblox Sword Tool Sword Script:
Is the sword script a local script? if so then I don’t think it’s possible to make humanoids sit locally and so you would need to send a remote event to the server.
I would try looking at the default Roblox linked sword for tips on how to organize functions within an event, currently your script is quite messy to read and understand as a result:
Ok so, I put the code in a local script and it semi-works.
I put the debug in too, now it prints “Worked” if you touch a player with the sword, but it doesn’t make them sit, I’m not sure why it won’t work as I have plenty of scripts using the same sit code that work. Do you think you know what might be going on?
Its an odd trade off if you put it in a local script then the mouse button1 down works but because of client replication you cannot change a humanoid’s status locally due to exploiter prevention
try putting this in your server script instead, this should work but without the mouse down input just on touch
put the touch event into a variable before the events and disconnect once you think it is not valid anymore.
Or else it will generate a lot of events that lags your game