Hello, I am trying to make my team change work with filtering enabled and I was told I need to use RemoveEvents in the ReplicatedStorage and then use a script in ServerScriptService to make them work, but I am having trouble getting them to work, can anyone help?
It’s better if you post what code you already have…
Client code is more of an example.
-- server
local teams = game.Teams
local changeTeam -- remote
changeTeam.OnServerEvent:connect(function(player, name)
local team = teams:FindFirstChild(name)
if team then
player.Team = team
end
end)
-- client
local changeTeam -- remote
local button
button.MouseButton1Click:connect(function()
changeTeam:FireServer(button.Name) -- or whatever you come up with to define what to send
end)
The server code should be put in ServerScriptService, you can assume this for most code. Though as with anything, you may find exceptions, just use judgement.
That’s exactly what I did, I put the client code in a local script inside the UI and it still doesn’t work, no matter how many times I click it. It works in test mode but not in game. Any advice?
Player = script.Parent.Parent.Parent.Parent.Parent
local GroupId = 1245097
script.Parent.MouseButton1Down:connect(function()
if Player:IsInGroup(GroupId) then
Player.TeamColor = BrickColor.new("Bright blue")
Player:LoadCharacter()
end
end)
To make your team change FE compatible as you already know you basically want a script that calls a remote event to change the team to whatever it is
when using a remote it already has the player put into the value so you dont need to send that over also load character doesnt working with local scripts you could load the player using the script that handles changing the team.