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

Why does this script not work?

Asked by 8 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

The script gives players a weapon based on their team. In 'play solo' mode, the tool gets equipped fine, but when I actually go in game, I can't even equip it. It keeps falling through workspace. (Before you ask, yes, the tool IS welded properly).

Here is the Starterpack script I'm using. It is in a local script (located in Replicated First), and since FE is on, there is a remote function connecting it.

local player = game.Players.LocalPlayer
function onPlayerAdded(player)
    player.CharacterAdded:connect(function()
        for _, team in pairs(game:GetService("Teams"):GetChildren()) do
            if team.TeamColor == player.TeamColor then
                for _, instance in pairs(team:GetChildren()) do
                    instance:Clone().Parent = player.Backpack
                end
            end
        end
    end)
end

for _, player in pairs(game.Players:GetPlayers()) do
    onPlayerAdded(player)
end

game.Players.PlayerAdded:connect(onPlayerAdded)

Answer this question