How to make a tool detect if it hit a player (or sum like that)

But anyways, you don’t have to measure magnitude from the player and the weapon, as this could be exploited too.

A .Touched event would be good enough, and isn’t inefficient at all.

it says “Infinite yield possible on ‘Workspace.Rig:WaitForChild(“Humanoid”)’” and does no damage. idk whats wrong.

i just realized what i can do, i can make a “kill brick” script for for the fists. but for the fist to not kill the player when he touches the fists. ill make it so the kill brick script gets enabled everytime i click.

yes thats an option however the code i gave u works fine with me can i see the layout of ur dummy"s do they have a humanoid, does ur handle have cantouch enabled?

3 Likes

for some reason, when i did what i said. the script just didnt enable. roblox just has to make stuff 100x harder than they should be

1 Like

i think what is not working. because in the script you said “If Tpart is a model” but its a tool, ill try to change that and see if it works

This is what could be happening to make your script not work:

1: You’re trying to host a .Touched function on the tool, not the actual handle part.
2: Your function might be trying to detect the character model, not the actual body parts.

1 Like

tpart is the part that it collided with wich is a body part so the parent should be a model/character, then i also check for it to have a humanoid and then damage that humanoid so it should work as it did with me

if u can add me i can fix it for you

bro, im not gonna lie, this been a year ago but i feel so stupid, when i could just do

local tool = script.Parent
local mouse = game.Players.LocalPlayer:GetMouse()
tool.Equipped:Connect(function()
mouse.Button1Down:Connect(function()
tool.Fist2.Touched:Connect(Function(Hit)
-- rest of the script
end)
end)
1 Like

lol, i mean u could also just do

local tool = script.Parent
tool.Activated:Connect(function()
--code here
end)