Need help with creating a "Battling Brawl" minigame (similar to survivor)

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 :man_shrugging:. How would you all go about it? This is my code, it is inside of the Roblox Sword Tool Sword Script:

script.Parent.Equipped:Connect(function(Mouse)
Mouse.Button1Down:Connect(function()
	script.Parent.Handle.Touched:Connect(function(hit)
		hit.Parent:FindFirstChild("Humanoid").Sit = true
	end)
  end)
end)
2 Likes

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.

It is not a local script, no, so I’m unsure as to why it still won’t work. How would you go about doing this?

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:

Tool.Activated:Connect(Activated)

Tool.Equipped:Connect(Equipped)

Tool.Unequipped:Connect(Unequipped)

Connection = Handle.Touched:Connect(Blow)

Moreover, have you tried print debugging? put this into your script and see if the touch event is happening.

print(hit.Parent)

EDIT: Nvm I think I found the issue

Since you mentioned this:

Player inputs only work on local script as the server cannot read the players keyboard

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?

Actually who is gonna sit the player who is holding the stick or the person who gets hit by the stick?

If you’re looking for what I am trying to achieve, see the video I linked.

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

script.Parent.Equipped:Connect(function(Mouse)
		script.Parent.Handle.Touched:Connect(function(hit)
			hit.Parent:FindFirstChild("Humanoid").Sit = true
		end)
end)

Thank you! This worked!! :smiley:

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