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

Removing Tool from StarterGear?

Asked by 10 years ago

So I have a part that when touched, removes a certain tool from the Backpack, Character, and StarterGear

When I touch it, it removes it from everything, but when my character Dies it re-appears in their inventory!

here's the script from the part that you touch

script.Parent.Touched:connect(function(hit)


    if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then



        local character = hit.Parent
        local player = game.Players:GetPlayerFromCharacter(character)
        local Bucket = player.Backpack:findFirstChild("Branch")
        local SG = player.StarterGear:findFirstChild("Branch")
        local equip = character:findFirstChild("Branch")

        if Bucket then
                Bucket:Destroy()
        end

        if equip then
                equip:Destroy()

        end

        if SG then
                SG:Destroy()

        end






    end



end)
0
Is this in a LocalScript or a Script? Discern 1007 — 10y
0
@Discern: It has to be a script, because he said it's in a part. Tkdriverx 514 — 10y

Answer this question