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

Team/Tool Removing Script Acts Server Sided?

Asked by
Omzure 94
3 years ago
Edited 3 years ago

Basic tool remover which removes your tools when you are on the 'Winner!' team, but it acts server sided and removes everybody's tools, not just yours. (LocalScript inside StarterGui)

local plr = game.Players.LocalPlayer
local char = plr.CharacterAdded or plr.CharacterAdded:Wait()

local bp = plr:WaitForChild('Backpack')
while true do
    wait(2)
    if plr.Team.Name == 'Winner!' then
        for i,t in pairs(bp:GetDescendants()) do
            if t and t:IsA('Tool') then
                t:Destroy()
            end
        end
        for i,t2 in pairs(char:GetDescendants()) do
            if t2 and t2:IsA('Tool') then
                t2:Destroy()
            end
        end
    end
end


0
How the hell did this question get 324 views LeedleLeeRocket 1257 — 3y
0
honestly have no idea Omzure 94 — 3y
0
somebody is probably spamming the refresh button Omzure 94 — 3y

1 answer

Log in to vote
1
Answered by 3 years ago

For the char variable, try putting plr.Character or plr.CharacterAdded:Wait() instead.

Instead of doing a while true loop, why not fire a client event whenever you determine the teams?

Ad

Answer this question