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

How can I make this script kill people who don't have ZAnimate? [Unsolved!]

How can I make this script everytime the brick is touched if they don't have ZAnimate in there Character they die. It works only 1 time then it breaks or something

function onHit(hit)
	local human = hit.Parent:findFirstChild("Humanoid")

if not hit.Parent:FindFirstChild("ZAnimate") then
	hit.Parent.Torso:remove()
end

	end

script.Parent.Touched:connect(onHit)

1 answer

function onHit(hit)
local human=hit.Parent:findFirstChild("Humanoid")
if human then if hit.Parent:FindFirstChild("ZAnimate")==nil then
hit.Parent.Torso:remove()
script.Parent.Disabled=true
end end end
script.Parent.Touched:connect(onHit)

If the problem is still going, it's probably because of "script.Parent.Disabled=true".

2 comments

0

what if we remove it ?

0

You should remove it, if you have that script inside a Part, then it's useless because you're doing script > Parent(Part) > Disabled=true (?) A part does not have a "Disabled" property unless script.Parent it's a Script too, again it would be useless because if it the parent was a script too, then script.Parent.Touched event it's completely useless.

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