(GUI IN THE WAY BUT IT SPAWNED ME AT MY ORIGINAL TEAM LOCATION)
I’ve tried searching up on Youtube and cannot find answers, I’ve had multiple of my other friends have this problem and even commissions I’ve been doing trying to solve this solution.
local plr = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function(click)
if plr:GetRankInGroup(14761109) >= 225 then
plr.TeamColor = BrickColor.new("Gold") -- (BY THE WAY, I RESPAWN)
end
end)
local plr = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function(click)
if plr:GetRankInGroup(14761109) >= 225 then
plr.Team = game:GetService("Teams")["Coast Guard Personnel"]
end
end)
This is because of replication boundaries. The server does not recognize that you have set your team color because if it is changed on the client, only that client can see it, but if it’s changed on the server, everyone can see it.
Let’s say you have a RemoteEvent in ReplicatedStorage named “ChangeTeam”.
Server Script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local event = ReplicatedStorage:WaitForChild("ChangeTeam")
event.OnServerEvent:Connect(function(plr:Player,team:Team)
if team and team:IsA("Team") then-- basically checking if the team argument is valid
if plr:GetRankInGroup(14761109) >= 225 then
plr.Team = team
end
end
end)
Local Script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local event = ReplicatedStorage:WaitForChild("ChangeTeam")
script.Parent.MouseButton1Click:Connect(function(click)
if plr:GetRankInGroup(14761109) >= 225 then
event:FireServer(path to team object goes here)
end
end)
Sorry if it doesn’t work, as I made this in the DevForum and not Studio.
local plr = game.Players.LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Event = ReplicatedStorage:WaitForChild("TeamChange")
local Teams = game:GetService("Teams")
local path = Teams.Headquarters
script.Parent.MouseButton1Click:Connect(function()
if plr:GetRankInGroup(14761109) >= 225 then
Event:FireServer(path)
end
end)
print(path:GetFullName())
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local event = ReplicatedStorage:WaitForChild("ChangeTeam")
event.OnServerEvent:Connect(function(plr:Player, team:Team)
if team and team:IsA("Team") then-- basically checking if the team argument is valid
if plr:GetRankInGroup(14761109) >= 225 then
plr.Team = team
end
end
end)
Is there anything I need to change to make it work? @Trafficboy05
You should be good to go, although you can remove the print statement, and probably use :WaitForChild() when getting the team, like this: local path = Teams:WaitForChild("Headquarters")