I need to know how to make a NPC that is removed when touching a certain gear in game and then re-appear after a minute
COMMUNITY QUESTION
How do you make a humanoid that is removed when touching a certain gear?
1 answer
LargeVIII, Heres your code:
local human = script.Parent.Parent
script.Parent.Touched:connect(function(hit)
if hit.Parent.Name == "Gear Name" then -- Change Gear Name to whatever the name of the gear should be.
children = human:GetChildren() -- A table of the children in the human
for i,child in pairs(children) do -- Simple loop
if child:IsA("BasePart") then -- Don't change BasePart to anything
child.Transparency = 1 -- Makes it invisible
child.Anchored = true -- Makes sure that it doesn't fall out of the world
child.CanCollide = false -- Makes it so that it can go through stuff
end
end
wait(time) -- change time to the time it is gone
for i,child in pairs(children) do -- Simple loop
if child:IsA("BasePart") then -- Don't change BasePart to anything
child.Transparency = 0 -- Makes it visible
child.Anchored = true -- Makes it unfrozen
child.CanCollide =true -- Makes it so that it can't go through stuff
end
end
end)
Make sure you put that in the part of the human you want to be the activator e.g, the torso of the humanoid. Sincerely, crazycittykat
This discussion is preserved as it was. New answers, comments, and votes are closed.
