Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

why wont my sword print the parent of the thing its touching or t make humanoids take damage?

script.Parent.Blade.Touched:connect(function(hit)
	if equipped and character and humanoid and humanoid.Health >= 0 and hit and not hit:IsDecendantOf(character) then
		target = hit.Parent:FindFirstChild'Humanoid'
		if target and target.Health >= 0 then
			print(hit.Parent.Name)
			target:TakeDamage(damage)
			
		end
		end
	end)

1 comment

1

try doing the hit event in another script, because at the current point, you are trying to do to much in 1 script.

1 answer

Just change all the stuff inside it to this:

script.Parent.Blade.Touched:connect(function(hit)
	if hit.Parent.Humanoid ~= nil then
	hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - (The damage u want)
        end
    end)

This discussion is preserved as it was. New answers, comments, and votes are closed.