Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I set a players spawn by there team color?

Asked by 4 years ago

I tried using a spawn location and setting the team color to that of the team and it works 1 out of 2 times, I have a button at the beginning that changes the team and loads character does that have something to do with it? Here is the script for the button.

--Button script in GUI
local Frame = script.Parent:WaitForChild("Frame")
local RemoteEvent = game.ReplicatedStorage.Events.ChangeTeam
local VikingColor = "Dark orange"
local ScandinavianColor = "Electric blue"

script.Parent:WaitForChild("TeamChnage").MouseButton1Click:Connect(function()
    Frame.Visible = not Frame.Visible
end)

Frame.Viking.MouseButton1Click:Connect(function()
    RemoteEvent:FireServer(BrickColor.new(VikingColor))
end)

Frame.Scandinavian.MouseButton1Click:Connect(function()
    RemoteEvent:FireServer(BrickColor.new(ScandinavianColor))
end)
--Remote Event script in ServerScripts
game.ReplicatedStorage.Events.ChangeTeam.OnServerEvent:Connect(function(player, teamcolor)
    player.TeamColor = teamcolor
    wait(0.5)
    player:LoadCharacter()
    wait(0.5)
end)
1
when u used spawn locations did you make sure player.Neutral is false? and SpawnLocation.Neutral is also false? b/c if it's not it causes the player to spawn at a random spawn location who's .Neutral property is true User#23252 26 — 4y
0
Thank you Brockanthony10 19 — 4y

Answer this question