Problem with DriveSeat and ProximityPrompt

  1. I am trying to make ProximityPrompt work with vehicle seat called DriveSeat.

  2. The issue is that the ProximityPrompt on DriveSeat shows up even if I am sat on passenger seat, which shouldn’t happen.

  3. I’ve tried looking at DevForum and still couldn’t find a solution.

So this is a ServerScript that is included in the ProximityPrompt:

local ProximityPromt = script.Parent
local seat = ProximityPromt.Parent
seat:GetPropertyChangedSignal("Occupant"):Connect(function()
	if seat.Occupant then
		ProximityPromt.Enabled = false
	else
		ProximityPromt.Enabled = true
	end
end)

ProximityPromt.Triggered:Connect(function(player)
	seat:Sit(player.Character.Humanoid)
end)

And this is the LocalScript included in StarterCharacterScripts to hide the proximity prompts once sat.

local char = script.Parent
local hum = char:WaitForChild("Humanoid")
local formersit

hum.Seated:Connect(function(seated, seatpart)
	if seated then
		local model = seatpart:FindFirstAncestorOfClass("Model")
		for _,v in pairs(model:GetDescendants()) do
			if v.ClassName ~= "ProximityPrompt" then continue end
			v.Enabled = false
		end
		formersit = model
	else
		for _,v in pairs(formersit:GetDescendants()) do
			if v.ClassName ~= "ProximityPrompt" then continue end
			v.Enabled = true
		end
		formersit = nil
	end
end)

Here’s a gif of my problem.
https://i.imgur.com/cOrUms6.mp4

Here’s the passenger seat.
image

Here’s the driver seat.
image

1 Like
local ProximityPromt = script.Parent
local seat = ProximityPromt.Parent

ProximityPromt.Triggered:Connect(function(player)
	seat:Sit(player.Character.Humanoid)
end)
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")

humanoid.Seated:Connect(function(isSeated, seatPart)
	local vehicle = seatPart:FindFirstAncestorOfClass("Model")
	if vehicle then
		for _, instance in ipairs(vehicle:GetDescendants()) do
			if instance:IsA("ProximityPrompt") then
				instance.Enabled = not isSeated
			end
		end
	end
end)
2 Likes

Unfortunately, this doesn’t work for me. Basically it breaks the whole ProximityPrompt.
I replaced the top script with ServerScript and the bottom one with LocalScript in StarterCharacterScripts.