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

Why team shown in GUI is not my team?

Asked by 10 years ago

Hello.

I'm new to Roblox, so excuse me if this question is stupid, but I didn't find anything in wiki.

I've created 2 teams "Mafias" and "Policemen". For now, I assign all players to mafias team. But in-game, every player gets Policemen team, I don't know why.

My code:

local mafiaTeam = nil
local policeTeam = nil

function onPlayerAdded(player)
    player.Neutral = false
    player.TeamColor = mafiaTeam.TeamColor -- set to mafia  
end

function setUp()
    mafiaTeam = Instance.new("Team", Game:GetService("Teams"))
    mafiaTeam.Name = "Mafias"
    mafiaTeam.TeamColor = BrickColor.Red()
    policeTeam = Instance.new("Team", Game:GetService("Teams"))
    policeTeam.Name = "Policemen"
    policeTeam.TeamColor = BrickColor.Blue()
end

setUp()
Game.Players.PlayerAdded:connect(onPlayerAdded)

What's the problem? If you can figure it out, help me please.

Thanks in advance

UPDATE: as it seems to be, the problem is with GUI. Physically, I'm in mafias team (I've checked player's properties with server console + my name color is red, as it should be if I'm in mafias team), but GUI shows that I'm in policemen team. Any suggestions?

0
I think this is most likely just a time issue -- I believe your script is working and it's simply acting too soon and the ROBLOX game is overriding your change. Try adding a wait(1) to the beginning of the player event. (I can't run this code to test). Remember that you can use Tools -> Start Server and Tools -> Start Player to test things like this from Studio and get output! BlueTaslem 18071 — 10y
0
Thanks, but that didn't help. However, I've checked the player's TeamColor and it's set to 'Bright red', but in the GUI I see that he's in Policemen team. PathDevel 0 — 10y
0
Here is the screenshot of GUI http://yadi.sk/d/73Pknat1MZwPx PathDevel 0 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago

Most likely the issue is, that the 'Play solo' mode loads player earlier than script get's to load. That is common and very frustrating problem, so instead do 'Start server' and within server 'Start player'.

0
I've read about it in Wiki, so I'm launching the server and client together. I'll try to launch them separately PathDevel 0 — 10y
0
OK, that didn't help either. PathDevel 0 — 10y
0
Updated the question PathDevel 0 — 10y
0
Is there a way to manualy update GUI? PathDevel 0 — 10y
Ad

Answer this question