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

Whats wrong with this script?

I was trying to make a script where when the zombies killed the arms don't kill you when dead. Heres what I got,

local Zom = script.Parent
local Health = Zom.Humanoid
local arm1 = Zom.zarm1
local arm2 = Zom.zarm2
if Health == 0 then
	arm1.damage2.Disabled = true
else
	arm1.damage2.Disabled = false
	if Health == 0 then
	arm2.damage1.Disabled = true
else
	arm2.damage1.Disabled = false
	end
end
end

1 answer

✓ Accepted answer

Use the died function and :Destroy() to destroy the scripts.

local Zom = script.Parent
local Health = Zom.Humanoid
local arm1 = Zom.zarm1
local arm2 = Zom.zarm2
Health.Died:connect(function() --When the humanoid Dies
    arm1.damage2:Destroy() --Destroy this script
    arm2.damage1:Destroy() --And this one.
    end
end
end)

8 comments

0

Doess not work.

0

The problem is probably the arms. Look in the zombie models. What are the arms and scripts called? Lua is Case Sensitive. So If you say "Print" instead of "print" It won't work because of one small mistake.

0

So I put this script inside the arm not the model right?

0

Put the script in the model. Just take a screenshot of the model in the explorer tab. I need to see what the arms and scripts are called. Is the zombie arm really called "zarm"?

0

Yes it is actually called zarm

0

Can you take a screenshot of your roblox studio? Also I need to see the "zarm" scripts name too.

0

How do I take a picture and send it to you?

0

There are websites where you can upload photos.

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