I have a TextLabel in my game, it’s supposed to show their team name, and colour
Screenshot:
[TEAM] will be changed to, for example
“Visitors” and the TextColor should be changed to Medium stone grey
it doesn’t work, here is the part of the script I use to attempt it.
local frame = ui.Frame
local name = frame.PlayerName
local role = frame.Rank
local team = frame.Team
local VisitorColour = Color3.fromRGB(163, 162, 165)
local StudentColour = Color3.fromRGB(248, 248, 248)
local StaffColour = Color3.fromRGB(13, 105, 172)
local CouncilColour = Color3.fromRGB(128, 187, 219)
name.Text = Player:GetRoleInGroup(11954854)..", "..Player.Name
role.Text = pRank
if role.Text == "Guest" then
role.Text = "Visitor"
end
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(chr)
team.Text = plr.Team
if plr.Team == "Visitor" then
team.TextColor3 = VisitorColour
elseif plr.Team == "Student" then
team.TextColor3 = StudentColour
elseif plr.Team == "Staff" then
team.TextColor3 = StaffColour
elseif plr.Team == "Council" then
team.TextColor3 = CouncilColour
end
end)
end)
I get nothing in output, I’ve also tried using the TeamColor property yet it doesn’t work
this didn’t work unfortunately, here is the code I used
local Players = game:GetService("Players")
local Teams = game:GetService("Teams")
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function()
if player.Team == Teams["Visitors"] then -- add, or Teams["(team name)"] to add more teams to it
team.Text = "Visitor"
team.TextColor3 = VisitorColour
elseif player.Team == Teams["Students"] then
team.Text = "Students"
team.TextColor3 = StudentColour
elseif player.Team == Teams["Staff"] then
team.Text = "Staff"
team.TextColor3 = StaffColour
elseif player.Team == Teams["Council"] then
team.Text = "Council"
team.TextColor3 = CouncilColour
end
end)
end)
Okay, i think the issue is the gui itself, the server doesn’t see it, because the client “cloned” it therefore only “replicating” to the client that cloned it.
Have you made sure the server clones the gui to character head?
You are very frustrating. Why even ask about this stuff if you never listen to ANYBODY. There is so many people with the right awnser but you keep changing the script the wrong way every time.
local __PLAYER = game:GetService("Players"):GetPlayerFromCharacter(script.Parent.Parent.Parent) -- first parent is billboardgui, second parent is head and third is character model!
local __TEAMS = game:GetService("Teams")
script.Parent.TextLabelHere.Text == __PLAYER.Team.Name -- make sure it runs in case the player is automatically assigned a team on cloned!
__PLAYER:GetPropertyChangedSignal("TeamColor"):Connect(function()
if __PLAYER.Team == __TEAMS["whatever"] then
script.Parent.TextLabelHere.Text = "whatever"
end
--[[ if you dont want an if statement you can do this
script.Parent.TextLabelHere.Text == __PLAYER.Team.Name
--]]
end)