I made a recent question with the same topic. However I am still having the same problem, I originally fixed it by turning off FilteringEnabled. However, FE is now a must, do to recent updates. The team switch script works just fine, it switches your team and doesn't have any difficulties.
--This is a local script local player = game.Players.LocalPlayer function onButtonClicked() player.TeamColor = BrickColor.new("Bright red") end script.Parent.MouseButton1Click:connect(onButtonClicked)
Unfortunately, the kill script works, except it doesn't respawn you at the intended team spawn, instead it keeps you at the lobby spawn even if you click it repeatedly. Not only that but, the system in place that's supposed to -1 to your Wipeouts when you click the team switch button also doesn't work. Here is the script for this...
--This is a normal script player = game.Players.LocalPlayer function onButtonClicked() script.Parent.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0 player.leaderstats.Wipeouts.Value = player.leaderstats.Wipeouts.Value - 1 end script.Parent.MouseButton1Click:connect(onButtonClicked)
I am extremely inexperienced when it comes to integrating Filtering Enabled, I understand you are supposed to use RemoveEvents and RemoveFunctions but I don't know exactly how to use those when it comes to these scripts or really how to properly use them at all.
EDIT: I managed to get it working properly in studio to where it spawns you in the corresponding spawn and doesn't confine you to the lobby. I used this tutorial to do it: https://www.youtube.com/watch?v=wic-N4JiFss&t=559s. However, I was not able to get it working in game despite using remote events and all. When I clicked the buttons they didn't even do anything at all.
Hi!
I am pretty sure teamswitching isn't allowed via a LocalScript. Considering everybody in the game needs to see you on the other team, a LocalScript changes it only for your client.
There is, however, a way to use it. I recommend you to look into RemoteEvents. They allow LocalScripts to execute Server-sided Scripts (such as your teamswitch). You can find more about that here, or somewhere on YouTube probably.
So yeah, it's completely normal for you to spawn on the old team's spot, because according to the server and other players, you're still on the old team!
Using a RemoteEvent would allow you to switch teams via the LocalScript, and allowing everyone else to see it aswell.
Hope this helps and good luck!