Alright so I posted this: https://scriptinghelpers.org/questions/63036/team-change-gui-textbuttons-are-only-working-in-studio-any-help (You should see the link above before answering here) And it did help me alot, but now that ive put FE its been a bit of a struggle. I have this ServerScript in the SSS that activates whenever the texbutton is clicked for a newTeam. I also have remoteEvent in the ReplicatedStorage. When I run the code im about to show you, I get this error:
FireEvent is not a valid member of RemoteEvent
This is my code(in the serverScript):
local remote = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
game.Players.PlayerAdded:Connect(function(Player)
local TeamChangeGUI = Player.PlayerGui:WaitForChild("TeamChangeGUI")
Player.PlayerGui.TeamChangeGUI.Frame.Blue.MouseButton1Click:Connect(function()
local NewTeamName = "Blue"
remote:FireEvent(NewTeamName)
end)
Player.PlayerGui.TeamChangeGUI.Frame.Blue.MouseButton1Click:Connect(function()
local NewTeamName = "Red"
remote:FireEvent(NewTeamName)
end)
end)
And this is my code in the TextButton, it is a local-script and I have another one with the exact same code in the other TextButton(if that matters):
local player = game.Players.LocalPlayer
local Remote = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
Remote.OnServerEvent:Connect(function(Player, NewTeamName)
local newTeam = game.Teams:FindFirstChild(NewTeamName)
if newTeam then
Player.Team = newTeam
workspace[Player.Name]:BreakJoints()
end
end)

2 comments
FireEvent? it should be FireServer or FireClient, FireServer if you are sending to the server from the client and FireClient if you are sending from the server to the client
^