I’m making a car and I’m trying to disable other prompts when player sits on a seat but it wont work.
this is my code:
Char.Humanoid.Seated:Connect(function(Active, SeatPart)
if SeatPart == nil then
if seat == nil then return end
local Attachment = nil
local height = -math.huge
for i, v in ipairs(seat:GetChildren()) do
if v.ClassName ~= "Attachment" then continue end
if v.WorldPosition.Y <= height then continue end
height = v.WorldPosition.Y
Attachment = v
end
Char.PrimaryPart.CFrame = Attachment.WorldCFrame
seat = nil
return
end
if SeatPart.Name ~= "Seat1" then return end
seat = SeatPart
SeatPart.Occupant.Changed:Connect(function()
if SeatPart.Occupant == nil then
SeatPart.Parent.Seat2.PassengerPromptPart.EnterPassengerSeatPrompt.Enabled = true
SeatPart.Parent.Seat3.PassengerPromptPart.EnterPassengerSeatPrompt.Enabled = true
else
SeatPart.Parent.Seat2.PassengerPromptPart.EnterPassengerSeatPrompt.Enabled = false
SeatPart.Parent.Seat3.PassengerPromptPart.EnterPassengerSeatPrompt.Enabled = false
end
end)
end)