The whole point of Filtering Enabled is to disallow a LocalScript from making server changes. This includes anything from teams, brick colors, character modification (WalkSpeed, inserting a hat, etc) and others which I won't mention.
So, for this, we will need to use FireServer in a RemoteEvent for this. FireServer fires the OnServerEvent event on the server using the arguments specified with an additional player argument at the beginning.
As a result, we will be communicating from the Local side to the Server side. If you want a full tutorial on how this whole "Filtering Enabled" feature works, be sure to check out the wiki here
Anyway, here's the script on the local side
script.Parent.Parent:WaitForChild("SwitchTeamsFrame").Rebels.MouseButton1Click:connect(function()
local teamColor = BrickColor.new("Bright red")
game:GetService("ReplicatedStorage"):WaitForChild("ChangeTeam"):FireServer(teamColor)
end)
Next, you need to insert this script into ServerScriptService and insert the following code
local event = Instance.new("RemoteEvent",game.ReplicatedStorage)
event.Name = "ChangeTeam"
event.OnServerEvent:connect(function(gamer,teamColor)
gamer.TeamColor = teamColor
gamer:LoadCharacter()
end)
If you have any questions or don't understand something, drop me a comment.
1 comment
That didn't work...