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

Starter pack tool giver and remove command not working?

Asked by 6 years ago
local com = ";remove gear"
players = game.Players:GetChildren()

game.Players.PlayerAdded:connect(function(player)

    if player:GetRankInGroup(42142) >= 7 then
    player.Chatted:connect(function(message)
        if message == com then
            game.players.StarterGear:ClearAllChildren()
            end
        end)
    end
end)

local com2 = ";add SMG"
players = game.Players:GetChildren()

game.Players.PlayerAdded:connect(function(player)

    if player:GetRankInGroup(42142) >= 7 then
    player.Chatted:connect(function(message)
        if message == com2 then
            game.ServerStorage.Tools.SMG:Clone().Parent = game.players.StarterGear
            end
        end)
    end
end)

On the ;remove gear command it removes starter gear. On the ;add SMG gear it adds the SMG gun to the starter gear. These commands don't work. Why is this?

0
game.ServerStorage.Tools.SMG:Clone().Parent = player:findFirstChild("Backpack") on Line 23 arshad145 392 — 6y
0
Try parenting to the Backpack, and clearing from the Backpack aswell. Goulstem 8144 — 6y
0
Remember :GetChildren() returns a table of the children. Also, using :GetPlayers() is a more definite way to know that you're recieving players in that table. turtleman4real 1 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Try to make it where it insert the tool into the backpack. Here's a code:

 game.ServerStorage.Tools.SMG:Clone().Parent = game.Players.LocalPlayer.Backpack

If that doesn't work, then try capitalizing "players". You say game.players, that might not work because it's case-sensitive.

game.players.StarterGear --game.Players.StarterGear
Ad

Answer this question