How do I do a Team check on a player?

Hello, Im making a RolePlay game and I have a problem with checking the Team of a player.

The frame should open only if the player’s team is equal to “Sellers” or “Taxi Drivers”, but it opens for all teams, while there are no script errors.

Here is my script :

script.Parent.MouseButton1Click:Connect(function(cl)
	local player = game.Players.LocalPlayer
	local team = game.Teams:FindFirstChild("Taxi Drivers")
	local team2 = game.Teams:FindFirstChild("Sellers")
	local ui = script.Parent.Parent.Parent.frameROB
if player.Team == team or team2 then
		ui.Visible = true
		script.Parent.Visible = false
	elseif player.Team ~= team1 or team2 then
		script.Parent.Text = "This type of cars unavailable for you!"
		wait(5)
		script.Parent.Text = "Job Cars"
end
end)
script.Parent.MouseButton1Click:Connect(function(cl)
	local player = game.Players.LocalPlayer
	local team = game.Teams:FindFirstChild("Taxi Drivers")
	local team2 = game.Teams:FindFirstChild("Sellers")
	local ui = script.Parent.Parent.Parent.frameROB
if player.Team == team or player.Team == team2 then
		ui.Visible = true
		script.Parent.Visible = false
	elseif player.Team ~= team1 or team2 then
		script.Parent.Text = "This type of cars unavailable for you!"
		wait(5)
		script.Parent.Text = "Job Cars"
end
end)

u also have to do player.Team ==
for the second team (team2)

2 Likes

Oh, thanks you so much! Now its working!

2 Likes