local players = game:GetService("Players") 
local player = players.LocalPlayer 
local button = script.Parent
local teams = game:GetService("Teams")
button.MouseButton1Click:Connect(function()
	if player.Team == teams.Red then
    local randomNumber = math.random(4) 
    local randomPart = game.Workspace.redSpawns:FindFirstChild("redSpawn"..randomNumber)
    local humanoidRootPart = player.Character.HumanoidRootPart
    humanoidRootPart.CFrame = CFrame.new(randomPart.Position.X, randomPart.Position.Y + 5, randomPart.Position.Z) 
	end)
	end

If i remove the if player.Team = teams.Red it works, but how could i make it work with it?

1 comment

0

what line is the error on