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

Change Teams button not working both ways?

Asked by 2 years ago
Edited 2 years ago
local player = game.Players.LocalPlayer
local Teams = game:GetService("Teams")
local RedTeam = Teams:WaitForChild("RedTeam")
local YellowTeam = Teams:WaitForChild("YellowTeam")

script.Parent.TextButton.MouseButton1Click:Connect(function()
    print(player.Team)
    if player.Team == RedTeam then
        player.Team = YellowTeam
    end
    if player.Team == YellowTeam then
        player.Team = RedTeam
    end
    --print(player.Team)
end)


Line 8 isn't being read. I start off as YellowTeam, I switch to RedTeam just fine. From RedTeam to YellowTeam it doesn't work. Why?

1 answer

Log in to vote
0
Answered by 2 years ago

It was resolved. I used an elseif statement lol.

Ad

Answer this question