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

When Team change it creates neutral team??

Asked by 1 year ago

I am trying to make a teamchanger gui issue is everytime I try changing teams it creates a new team (Neutral) and puts me in it. I already have one team that is autoassignable which is citizens then I got 2 teams one is prisoner and the other cop which has autoassignable off.

Local script in button

script.Parent.MouseButton1Click:Connect(function()

    local team = script.Parent.Text

    game.ReplicatedStorage.ChangedTeam:FireServer(team.Value)

end)


Script in Severscriptservice

game.ReplicatedStorage.ChangedTeam.OnServerEvent:Connect(function(player, team)



    player.Team = team



    player:LoadCharacter()



end)


2 answers

Log in to vote
1
Answered by 1 year ago
Edited 1 year ago

The “Neutral” Team being created means that there is a player that hasn't been assigned to a team, which means that your script simply isn't updating the team of the player is in correctly.

This is likely due to what the other answer already mentioned:

It should be :FireServer(team) and not :FireServer(team.Value) as you have already declared team as the .Text property of an instance.

Edit: I recommend trying to change player.Team = team to player.Team = game.Teams:FindFirstChild(team), since usually the Team property of a Player takes a team-instance, not a string.

0
It stopped making the neutral team but it completely doesn't work and comes up with an error: cannot assign team something like that theking66hayday 841 — 1y
0
That issue is caused by the server script listening for the remote. Check my edit. DindinYT37 246 — 1y
0
Thank you so much it works now!! theking66hayday 841 — 1y
Ad
Log in to vote
1
Answered by 1 year ago
Edited 1 year ago

you don't need to put value at the end. game.ReplicatedStorage.ChangedTeam:FireServer(team)

0
It stopped making the neutral team but it completely doesn't work and comes up with an error: cannot assign team theking66hayday 841 — 1y
0
hmm, thats odd. bittyboy1234 91 — 1y

Answer this question