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

What's the problem with my script?(UNSOLVED)

Asked by 10 years ago

My script is just to pick a random person in Terrorist team and Give him a C4 bomb

    local TT = game.Teams.Terrorist:GetChildren()
    c4Terrorist = TT[math.random(1 , #TT)]
    game.ReplicatedStorage.C4Bomb:Clone(c4Terrorist.Backpack)
    game.ReplicatedStorage.C4Bomb:Clone(c4Terrorist.StarterGear)

my computer show error like missing interval

1 answer

Log in to vote
0
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
10 years ago

A team does not have children. The players on a team are not children of the team; they remain children of the Players service.

Regardless, if there are no such children, math.random(1,0) will error. You must check that there is a choice before continuing.

local team = {};
for _,player in pairs(game.GetChildren(game:GetService"Players")) do
    if player.TeamColor == game:GetService("Teams")["Team Name"]).TeamColor then
        table.insert(team,player);
    end
end

You also have poor taste.

0
I dont understand wat ur script is i just understood that ur telling teams dont have children stackyjack 0 — 10y
Ad

Answer this question