ProximityPrompt acting weird

What I am trying to do

I want it so that when script.Parent (ProximityPrompt) is triggered, script.Parent.Parent.DriveSeat (Car Models Driveseat), I can use :Sit(player.Character.Humanoid) on it. For some reason, this is only working on one car, and not the others.

I tried in a serverscript and local script.

script.Parent.Triggered:Connect(function(player)
	print("Triggered")
	if player.Character and player.Character.Humanoid then
			local humanoid = player.Character.Humanoid
			local seat = script.Parent.Parent.DriveSeat
			seat:Sit(humanoid)
		end
end)

So this works on one car, I duplicated the proximityprompt and script that is inside it to another car model. When I triggered the proximity prompt, nothing happened.

Why I am posting here: I tried to find out the issue, and the funny thing was is that it didn’t even print “Triggered”, which stopped me because I have no idea why it didn’t print that atleast. I tried that in a serverscript and local script, it didn’t print triggered in each.

image

This is the car.

Any help?

Hi!

Try putting your proximity prompts and its content (same hierarchy) in DriveSeat. Don’t forget to modify the code as well. Works well otherwise, so be sure you have similarly built cars and correct paths.

script.Parent.Triggered:Connect(function(player)
	if player.Character and player.Character.Humanoid then
		local humanoid = player.Character.Humanoid
		local seat = script.Parent.Parent
		seat:Sit(humanoid)
	end
end)

For some weird reason, when I put it into the drive seat,the proximity prompt does not appear at all. Only works when in the model.

local Seat = script.Parent.Parent.DriveSeat

script.Parent.Triggered:Connect(funtion(player)
local character = player.Character
	if character then
		local humanoid = character:FindFirstChildOfClass("Humanoid")
		if humanoid then
			Seat:Sit(humanoid)
		end
	end
end)

does the model have the primarypart defined?

Yes, its in the body of the car model.

I get that, but the problem isn’t even that, its that the proximity prompt doesnt even appear if its not just inside the model. Even then, that triggered event doesn’t even work. So thats what is stumping me.

I think you should put the prompt in the seat.

Yeah, I tried that. When I put it in the seat, the proximity prompt didn’t even appear (yes it is enabled and the max activation distance is good.) Which is why I think this problem is really weird, dont get at all why it isnt working.

Could you try using this one? It’s an example from 1 of the ProximityPrompt scripts in the Dev API

local proximityPrompt = script.Parent
local seat = proximityPrompt.Parent.DriveSeat
 
seat:GetPropertyChangedSignal("Occupant"):Connect(function()
    if seat.Occupant then
        proximityPrompt.Enabled = false
    else
        proximityPrompt.Enabled = true
    end
end)
 
proximityPrompt.Triggered:Connect(function(player)
    seat:Sit(player.Character.Humanoid)
end)

Tried it. It doesnt work. It didnt even print that it was triggered, the proximity prompt isnt working at all and i dont think its my fault. Im pretty sure this is a bug, but I cant be sure. Because it isnt even sensing that it was triggered so…?

Edit: Turns out that it was jsut that i needed to look at it from another angle and the prompt showed- still doesnt make me sit though.

So I found something out, i was thinking, “Is this script even working”, so i just did a print without any context. It didn’t print, for some reason the script isnt even “on”?

No it is not disabled.

Any script that is within the model is not working, I have no idea why.

Note: this car is cloned from a car in replicated storage, that when I bring it to workspace the proxprompt works and all, its when i clone it for some reason it wont work.

Its like when i do :clone() on it, all the scripts inside the model disable, but the actual property says they arent disabled. Before i clone them, they all work. I dont know what im doing wrong when im cloning it, its just making all scripts inside not work.

I found the issue- I just needed to parent it to workspace beforehand, i dont know why. But, its fixed. Thanks for all the help though!

1 Like