Hello, I’m doing a main menu with a team changer.
I added all the teams into separated frames, as you can see at this photo
That local script controls everything at the main menu (blur background, camera position, GUI tweening…) and everything is working fine. Everything works except the team changer
--// Team Changer \\--
script.Parent.CO.Join.MouseButton1Click:Connect(function()
local Response = game.ReplicatedStorage.MainMenu.ChangeTeam:InvokeServer(game.Teams["Correctional Staff"])
wait(0.1)
if Response == "Success" then
repeat wait()
game.Workspace.Camera.CameraType = Enum.CameraType.Custom
until game.Workspace.Camera.CameraType == Enum.CameraType.Custom
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
Blur.Enabled = false
wait(0.2)
game.ReplicatedStorage.Respawn:FireServer()
end
end)
We can find this script at the local script of the main menu.
The team change is controlled by this script, located at ServerScriptService
game.ReplicatedStorage.MainMenu.ChangeTeam.OnServerInvoke = function(plr, code, team)
if team == game.Teams.Inmate then
plr.Team = game.Teams.Inmate
return "Success"
elseif team == game.Teams["Correctional Staff"] then
if plr:GetRankInGroup(6291775) >= 4 then
plr.Team = team
return "Success"
end
elseif team == game.Teams["Emergency Response Team"] then
if plr:GetRankInGroup(6291775) >= 6 then
plr.Team = team
return "Success"
end
elseif team == game.Teams["High Command"] then
if plr:GetRankInGroup(6291775) >= 12 then
plr.Team = team
return "Success"
end
elseif team == game.Teams["Redacted"] then
if plr:GetRankInGroup(4965929) >= 2 then
plr.Team = team
return "Success"
end
end
end
game.ReplicatedStorage.Respawn.OnServerEvent:Connect(function(plr)
plr:LoadCharacter()
end)
(And i’m using a remote function, located at ReplicatedStorage)
I already changed some parts of the script a lot of times, but I can’t make it work.