What? Pls Fix This Idk How To
local tool = script.Parent local function onTouch(partOther) local humanOther = partOther.Parent:FindFirstChild("Humanoid") if not humanOther then return end if humanOther.Parent == tool then return end humanOther:TakeDamage(25) end tool.Activated:Connect(onTouch)
This should happen when the sword touches something, since that will tell the part that touched it
tool.Touched:Connect(onTouch)
edit: also place this script in the weapon's handle
The error is in the line:
tool.Activated:Connect(onTouch)
The function onTouch has one parameter: partOther. When the tool is activated, you called the function onTouch, but you didn't give it any parameters. Therefore partOther would be nil. Fix:
local tool = script.Parent local function onTouch(partOther) local humanOther = partOther.Parent:FindFirstChild("Humanoid") if not humanOther then return end if humanOther.Parent == tool then return end humanOther:TakeDamage(25) end tool.Activated:Connect(onTouch('whatever partOther is'))