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

Why isn't this doing damage when it touches one of these parts?

It's supposed to do damage when an enemy touches"hs" or "hss"

hs.Touched:connect(function(dmg) -- if you touch this
			hss.Touched:connect(function(dmg)-- or this it does 10 damage but it no do that :c
            if dmg.Parent:FindFirstChild("Humanoid")~= nil then
	if dmg.Parent.Name ~= plr.Name then
	dmg.Parent.Humanoid:TakeDamage(10)
		hs:Remove()
				hss:Remove()
	end
end
		end)
		end)

2 comments

0

Please read your code

0

LOL

2 answers

You need to define hs and hss. That is also called making a variable

Example:

Baseplate = game.Workspace.Baseplate 

For more info on variable visit

http://wiki.roblox.com/index.php?title=Variable

4 comments

0

I did that.......that was the first thing I did.

0

Thats not what it shows... You just put it into an event

0

Thats part of the full script. This is the damage part I do this so people can't copy my scripts.

0

How can we help you, if you don't show us the full script.

Well, assuming that all the variables are not nil (are defined) then this should work perfectly fine. I'm not 100% sure why your original script did not work, but I have an idea. Oh well, try this:

hs.Touched:connect(function(dmg) -- if you touch this
    if dmg.Parent:FindFirstChild("Humanoid")~= nil then
		dmg.Parent.Humanoid:TakeDamage(10)
		hs:Remove()
        hss:Remove()
	end
end)
hss.Touched:connect(function(dmg)
	if dmg.Parent:FindFirstChild("Humanoid")~= nil then
		dmg.Parent.Humanoid:TakeDamage(10)
		hs:Remove()
        hss:Remove()
	end
end)

Oh and please, could you use code indentation next time for making it easier for people to read your script (I hope this doesn't sound like I'm acting aggressive towards you)? Thank you.

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