So what I am trying to create is a TeamChanger, if a button is pressed the LocalScript fires the Server and a Script in ServerScriptService will connect on it, but I have one problem.
I want that the ServerScript to connect only to one function when the LocalScript has fired the Server (Each Join Button for the Teams fire the Same RemoteEvent)
So basically if Button1 will be Pressed the Script will only use Function1
But if Button2 will be pressed the Script will only use Function2 and so on.
Any Ideas?
Update:
All Buttons LocalScript:
TR = game.ReplicatedStorage.TeamChangeRE
function buttonPressed()
TR:FireServer()
end
script.Parent.MouseButton1Click:Connect(buttonPressed)
Serverscript:
local Team = game:GetService("Teams")
local TRE = game.ReplicatedStorage.TeamChangeRE
function CDTeam(player)
if player:IsInGroup(7465879) == 1 then
player.Team = Team["Class-D"]
end
end
function FPTeam(player)
if player:IsInGroup(7465879) == 3 then
player.Team = Team["Foundation Personnel"]
end
end
TRE.OnServerEvent:Connect(CDTeam)
TRE.OnServerEvent:Connect(FPTeam)
Basically what I am trying to reach is that if a Button has been pressed, only a specific Function in the Script will fire instead of all. (Which causes that the player is getting Teamed Multiple Times)