Hello.
I am currently writing this tired as ever, but still coding away. I’m having trouble with a team GUI switch. It’s meant to work that there is a lobby team (the color is fossil) and you can switch to either blue or red. Originally it could only switch between blue and the spectator team, so I tried fixing that. But now no teams switch at all. It’s probably an easy fix that my sleep deprivated mind couldn’t figure out, but if anybody got help, please send it through.
LocalScript inside of TextButton.
local remoteEvent = game.ReplicatedStorage.Team
local blue = "Bright blue"
local red = "Bright red"
local fossil = "Fossil"
local lolplayer = game.Players.LocalPlayer
local val = Instance.new("BoolValue")
val.Name = "inout"
val.Parent = lolplayer
local blueTeam = #game.Teams.Blue:GetPlayers()
local redTeam = #game.Teams.Red:GetPlayers()
local noSwitch = false
print(lolplayer.TeamColor)
script.Parent.MouseButton1Click:Connect(function()
if lolplayer.TeamColor == blue or lolplayer.TeamColor == red then
remoteEvent:FireServer(BrickColor.new(fossil))
elseif blueTeam < redTeam or blueTeam == redTeam and lolplayer.TeamColor == fossil then
remoteEvent:FireServer(BrickColor.new(blue))
elseif blueTeam > redTeam and lolplayer.TeamColor == fossil then
remoteEvent:FireServer(BrickColor.new(red))
end
end)
Remote Event Fire
game.ReplicatedStorage.Team.OnServerEvent:Connect(function(player, teamColor)
player.TeamColor = teamColor
player:LoadCharacter()
player.leaderstats.Deaths.Value = 0
player.leaderstats.Kills.Value = 0
end)
NOTE: Some parts of the script are not relevant to what is written, included because will add more later on.
