Hello DevForum! This is my first post here:
I have made a team change GUI with RemoteEvents (to clarify that I didn’t do it client-side only). The way it works is that it puts a player as neutral by default, if a team is chosen, a remote event is fired and the player is teamed to the right team and then player:LoadCharacter(). If a player doesn’t select a team tho, they are automatically put into Inmate team. This is how it all looks:
Team change UI handler (Client)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TeamChange = ReplicatedStorage:WaitForChild("TeamChange")
local LoadCharacter = ReplicatedStorage:WaitForChild("LoadCharacter")
local Inmate = "Gold"
local Staff = "Storm blue"
script.Parent.MenuFrame.PLAY.TextButton.MouseButton1Click:Connect(function()
script.Parent.Enabled = false
game.Players.LocalPlayer.PlayerGui.MainMenuBG.Enabled = false
LoadCharacter:FireServer()
end)
script.Parent.MenuFrame.PLAY.MAINS.Inmate.MouseButton1Click:Connect(function()
TeamChange:FireServer(BrickColor.new(Inmate))
end)
script.Parent.MenuFrame.PLAY.MAINS.Staff.MouseButton1Click:Connect(function()
TeamChange:FireServer(BrickColor.new(Staff))
end)
Team change handler (Server)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
ReplicatedStorage.TeamChange.OnServerEvent:Connect(function(player, teamColor)
player.TeamColor = teamColor
end)
ReplicatedStorage.LoadCharacter.OnServerEvent:Connect(function(player)
if player.Neutral ~= true then
player:LoadCharacter()
else
player.Neutral = false
player.TeamColor = BrickColor.new("Gold")
player:LoadCharacter()
end
end)
And now the problem: why doesn’t my character appear on the right spawn pad?
What's happening (Video)
All the spawns are set correctly (at least I think so)
Is it Roblox or did I miss something? Please give me an answer if possible, thanks!
