Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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.

1 comment

0

I dont understand wat ur script is i just understood that ur telling teams dont have children

This discussion is preserved as it was. New answers, comments, and votes are closed.