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

How to take away gear when teleport? [closed]

Asked by 10 years ago

I have put in a teleportation script in my game where you click the GUI and you teleport to a part. But the thing is, I also want the GUI (or Script) to take away the gear that the player has so they can't harm players (It is an AFK Lobby in a murder game. You teleport to the Lobby so that you can't get killed if your AFK, but I don't know how to make it so it takes gear away).

2
Use the :Destroy() method. EzraNehemiah_TF2 3552 — 10y
0
How? hunkilicous12 2 — 10y

Closed as Not Constructive by Goulstem, Redbullusa, and BlueTaslem

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
10 years ago

To do this you'd have to iterate through all the children of your player's backpack, if any children are tools or hopperbins then destroy them. Same thing with the player's character because the could be equipping something.

plr = --define plr

function noTools(plr)
    for i,v in pairs(plr.Backpack:GetChildren()) do
        if v:IsA('Tool') or v:IsA('HopperBin') then
            v:Destroy()
        end
    end
    for i,v in pairs(plr.Character:GetChildren()) do
        if v:IsA('Tool') or v:IsA('HopperBin') then
            v:Destroy()
        end
    end
end

noTools(plr);
Ad