You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I want the player to spawn on Sea Green color spawn.
What is the issue? Include screenshots / videos if possible!
The player is not spawning on sea green spawn but instead in the Lobby’s spawn which is the default.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried changing the spawn team color, consult other devforum posts and rewrote my script many times.
Here is my script.
local player = game:GetService("Players").LocalPlayer
function Click()
script.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new("Sea green")
script.Parent.Size = UDim2.new(0, 550,0, 300)
wait(1)
if player.Character and player.Character:FindFirstChild("Humanoid") then
player.Character.Humanoid.Health = 0 -- Changes health to 0
end
script.Parent.Parent.Parent:Destroy() -- Delete the team change GUI
end
script.Parent.MouseButton1Down:connect(Click)
What you should be doing is setting the player Team to a specific team when the button is clicked Player.Team = (Team) (sorry if i am not explaining well)
This should help:
or this:
Also you make sure their aren’t any teams that are “neutral” or have the auto-assignable property
The video is not loading, but as @RudraVII said you should be using a script somewhere on the server and setup a Remote connection (i miss interpreted your question, sorry) , but i also recommend you clean up your code a little and do something something like this for changing player teams:
----Server Script
local RemoteEvent = ----Where the remote event is
RemoteEvent.OnServerEvent:Connect(function(player)
if player then
player.TeamColor = ------TeamColor
end
end)
-----Localscript
local gui = script.Parent
local player = game.players.LocalPlayer
local RemoteEvent = ---where the remote event is
function Click()
script.Parent.Size = UDim2.new(0, 550,0, 300)
wait(1)
if player.Character and player.Character:FindFirstChild("Humanoid") then
player.Character.Humanoid.Health = 0 -- Changes health to 0
end
RemoteEvent:FireServer()----No need to add the player parameter because its the first parameter given
script.Parent.Parent.Parent.Visible = false ----instead of destroying the gui simply set the visible property to false
end
Gui.MouseButton1Down:connect(Click)