I made a sword that consists of 2 scripts, the damage and the main script.This happens when I hit the dummy and then hit away from the dummy. This is the error I am getting: https://prnt.sc/s4wr1p
Here is the damage script
local db = false script.Parent.Handle.Touched:Connect( function(hit) if db == false then if hit.Parent.Humanoid then db = true hit.Parent.Humanoid:TakeDamage(10) script.parent.blood.PlaybackSpeed = math.random(1.0, 1.2) script.parent.blood:Play() wait(.5) db = false script.Disabled = true else return end end end )
You need to check first if the thing the sword is touching is an humanoid (an dummy or person) Here is what i mean:
local db = false script.Parent.Handle.Touched:Connect( function(hit) if db == false then local human = hit.Parent:FindFirstChild("Humanoid") if human then db = true human:TakeDamage(10) script.parent.blood.PlaybackSpeed = math.random(1.0, 1.2) script.parent.blood:Play() wait(.5) db = false script.Disabled = true else return end end end )
Tell me if something is wrong here Hope it helped.