I made a vehicle with a proximity prompt and now I am trying to make it only drivable if the player is on a certain team and it isn’t working.
Regardless of which team I am on it prints the else.
local vehicle = script.Parent.Parent.Parent
local body = vehicle.Body
local seat = script.Parent.Parent
local colorPart = script.Parent.Red
local proximityPrompt = seat.ProximityPrompt
seat:GetPropertyChangedSignal("Occupant"):Connect(function()
if seat.Occupant then
proximityPrompt.Enabled = false
else
proximityPrompt.Enabled = true
end
end)
proximityPrompt.Triggered:Connect(function(player)
if player.Team.Name == colorPart.Name then
seat:Sit(player.Character.Humanoid)
else
print(player.Name .. " tried to enter the wrong team's vehicle.")
end
end)