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

Unequip tool if inside FF ?

Asked by
Elixcore 1337 Moderation Voter
6 years ago
game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(function(chr)
    while true do
        if chr.ForceField ~= nil then
chr.Humanoid:UnequipTools()
        end
    end
end)
end)

--need to fix

the script above does not work and i am wondering how to make one.

0
Also, you have to make sure that a force field event exists upon spawning. So, if you have a Spawn from studio, then it should probably be there. KingLoneCat 2642 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Hey Elixcore, Your problem is very simple to fix, I will just show it below rather than explaining it up here because it's easier that way.

game.Players.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Connect(function(char)
        while wait() do -- You should have a wait for a while loop just in-case it runs too long.
            if char:FindFirstChild("ForceField") then -- Checks if Force Field exists in the character
                local hum = char:WaitForChild("Humanoid");
                hum:UnequipTools(); 
            end
        end
    end)
end)

Well, I hope I helped and have a nice day!

~~ KingLoneCat

0
Thank you soo much! it works perfectly! Elixcore 1337 — 6y
0
No problem. KingLoneCat 2642 — 6y
Ad

Answer this question