Here is my script its not a local script The problem is that it doesnt change the gui message. Its probly because i didnt access PlayerGui properly I want it to say the message if the ammount of players is below 2
local Teams = game.Teams local Players = game.Players:GetPlayers() local timeleft = game.Workspace.timeleft.Value function Checkforplayers() if #Players >= 2 then else Players.PlayerGui.ScreenGui.Message.Text = "2 Players are needed! Invite a friend or come back later" end end function Createteams() local Cops = Instance.new("Team") Cops.Name = "Cops" Cops.Parent = game.Teams Cops.TeamColor = BrickColor.new("Bright blue") wait(1) end while true do if #Players <= 1 then Checkforplayers() Createteams() end end
Please help how do i do this?
Players
is merely a table of players. You need to iterate through it in order to set GUI text like that.
for _, player in pairs(Players) do player.PlayerGui.ScreenGui.Message.Text = "2 Players are needed! Invite a friend or come back later" end
The rest of your script is pretty wacky, but I guess I answered your question.