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

Implementing teams to this script? [Help]

Asked by 10 years ago

So, I'm developing a game called 'Bullseye', I'm working on adding a lobby script and I've done most of it but I don't know how to implement teams into the script, if someone could help me I would really appreciate it, the teams are "Feds", "Terrorists" & "Civilians", I need to somehow make the script randomly place players into one of the teams. [Feds should have 2nd most players, Civilians should have the most players and Terrorists should have around 2-3 players in it]

Thanks for any help! Your help is greatly appreciated!

Here is the script:

while true do local start = 10

local hint = Instance.new("Hint") hint.Parent = game.Workspace for i = 1,start do hint.Text = start - i wait(1) end hint.Text = "Game Starting" -- Change this to what you want it to say when its starting the game wait(2) hint:remove()

target = CFrame.new(-4.4, 98.39, 34.4) -- Location you want them to go for i, player in pairs(game.Players:GetChildren()) do player.Character.Torso.CFrame = target + Vector3.new(0, i * 5, 0) end

local start = 500 local hint = Instance.new("Hint") hint.Parent = game.Workspace for i = 1,start do hint.Text = start - i wait(1) end hint.Text = "Game Over" -- Lose message p = game.Players:GetChildren() for i = 1,#p do p[i].Character.Head:remove() end wait(2) hint:remove()

end

0
Anyone? Kinng1826 0 — 10y

1 answer

Log in to vote
0
Answered by
Gamenew09 180
10 years ago

Please use the code block, it is the lua badge on the top of the posting box. It's really simple to change the player's team to a random team. Just get an random team the get the team color then set the player's TeamColor to the team's color.

function putOnRandomTeam(ply)
    ply.TeamColor = game.Teams:GetChildren()[math.random(1, #game.Teams:GetChildren()].TeamColor -- Set's the team color to a random teams color which sets it to that color's team.
end
-- Now just call putOnRandomTeam on all players.
for i,v in pairs(game.Players:GetPlayers())do
    putOnRandomTeam(v)
    -- Put your game code below or on top of the function.
end
Ad

Answer this question