Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

FF Remover not working? [SOLVED, THANKS FOR HELP]

Asked by 10 years ago

The FF script is not working, I cannot figure out why. Can you help?

while true do
game:FindFirstChild("ForceField"):remove()
end

0
Alright. Thanks! CoderOfTheMonth 0 — 10y

2 answers

Log in to vote
3
Answered by
DevChris 235 Moderation Voter
10 years ago

I wouldn't suggest using supercoolguy's method as the ForceField might not always exist. Instead, this code would not break:

script.Parent.Touched:connect(function(touch)
    if touch.Parent:FindFirstChild("Humanoid") and touch.Parent:FindFirstChild("ForceField") then
        touch.Parent.ForceField:remove()
    end
end)
Ad
Log in to vote
0
Answered by 10 years ago

Try this:

function ff(part)
    local h = part.Parent:findFirstChild("Humanoid")
    if h then
        h.Parent.ForceField:Destroy()
    end
end
script.Parent.Touched:connect(ff)

The reason it isn't working is because ForceField isn't a child of Game, but the ForceField is a child of the Humanoids parent. Place this into a part.

0
Thank you! CoderOfTheMonth 0 — 10y

Answer this question