I would like to make a script to choose a player in a team and then move them to that team and display that on a gui. Here is what I have so far:
status.Value = "There aren't any spectators in the game so it will be random." wait(5) status.Value = "Choosing Player." wait(3) for i, v in pairs(game:GetService('Teams'):FindFirstChild('Players'):GetPlayers()) do if v then local vValue = Instance.new("IntValue", replicatedStorage.Players) vValue.Name = v.Name vValue.Value = 0 end end for _, v in pairs(replicatedStorage.Players:GetChildren()) do local randomPl = replicatedStorage.Players:GetChildren()[math.random(1,#replicatedStorage.Players:GetChildren())] if randomPl == v.Name then if v:IsA("IntValue") then v.Value = 13 end end end status.Value = "Player Chosen." wait(2)
2nd part:
for i, v in pairs(replicatedStorage:FindFirstChild("Players"):GetChildren()) do if v.Value > highest and v.Value ~= 0 then highestP = v highest = v.Value elseif v.Value == highest and v.Value ~= 0 then local random = math.random(1,2) if random == 1 then highestP = v highest = v.Value end print(highestP) print(highest) end end
and the 3rd:
for _, v in pairs(game.Players:GetPlayers()) do local chatScreen = v:FindFirstChild('PlayerGui').ChatScreen chatScreen.MainFrame:TweenPosition(UDim2.new(0.5, -400, 0.5, 100), "Out", "Back", 1) end wait(1) chatValue.Value = 'The person doing the minigame will be...' wait(5) chatValue.Value = "It's "..highestP wait(2) chatValue.Value = "" for _, v in pairs(game.Players:GetPlayers()) do local chatScreen = v:FindFirstChild('PlayerGui').ChatScreen chatScreen.MainFrame:TweenPosition(UDim2.new(0.5, -400, 0.5, 800), "In", "Back", 1) end game.Players:FindFirstChild(highestP).TeamColor = BrickColor.new('Bright yellow') replicatedStorage.Players:GetChildren():Destroy() local highestPlayer = "" local highest = 0
Sorry for all the parts but it was easier like that.