I’m making a UI for high-rank members of a group that can change player teams and it works for the most part but the chat color doesn’t seem to display nor do I get a message saying my team has been changed on the client. I’ve made it so the server changes a player’s team not the client too so that isn’t the issue.
I’ve copied and edited down the parts of my client localscript and server script that are responsible for this below.
Thanks in advance for any help.
-- client localscript
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local CtrlEvent = ReplicatedStorage:WaitForChild("CtrlEvent")
local function checkUsername()
local strg = ui.TextBox.Text
if strg=="" or strg==nil then return false end
local playerTable = {}
for _, player in pairs(Players:GetPlayers()) do
if string.lower(string.sub(player .Name, 1, string.len(strg)))==string.lower(strg) then
table.insert(playerTable, player)
end
end
if #playerTable~=1 then return false else
return unpack(playerTable)
end
end
ui.Alpha.MouseButton1Click:Connect(function()
local user = checkUsername()
if user==false then return else
CtrlEvent:FireServer("player", "alpha", user)
end
end)
-- server script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local CtrlEvent = Instance.new("RemoteEvent"); CtrlEvent.Name = "CtrlEvent"; CtrlEvent.Parent = ReplicatedStorage
CtrlEvent.OnServerEvent:Connect(function(player, type, subtype, args)
if typ=="player" and args:IsA("Player") then
if subtype=="alpha" then
if Teams:WaitForChild("Alpha",3) then args.Team=Teams.Alpha end
end
end
end)
Again, everything works fine and well, even Player.Team and Player.TeamColor = The proper team and team color on both the server and client but the color in chat doesn’t seem to change at all.