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
7 years ago
01game.Players.PlayerAdded:connect(function(plr)
02plr.CharacterAdded:connect(function(chr)
03    while true do
04        if chr.ForceField ~= nil then
05chr.Humanoid:UnequipTools()
06        end
07    end
08end)
09end)
10 
11--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 — 7y

1 answer

Log in to vote
0
Answered by 7 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.

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

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

~~ KingLoneCat

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

Answer this question