Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

My TeamChange GUI still does not work. Can you guys correct my code or something?

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

0

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

0

^

1 answer

FireEvent is not a thing. You're gonna want to use remote:FireServer() if you trying to fire a server script and remote:FireClient() or remote:FireAllClients() depending on what you want to happen. First one is for one specific player and the other is for all players.

1 comment

0

This isnt very specific. And even after working this out, it doesnt work and no error pops up. Any help?

This discussion is preserved as it was. New answers, comments, and votes are closed.