Script problem with ProximityPrompt Door

Hello, I’m DarkBegin, I’m trying to script a door with the new feature ProximityPrompt.


This is my script, and my parts are all anchored in the workspace.
Do you have any idea where the problem is from? Thank you.

2 Likes

Well you have a variable called ProximityPrompt = script.Parent.Door
According to wiki ProximityPrompt is like a new value that you have to add on if I’m explaining that good enough.

Basically the problem is you’re not actually accessing the Proximity prompt, allow me to pull the example from wiki.

  1. workspace.Part.ProximityPrompt.Triggered:Connect(function(player)
  2. print(“The user interacted with me!”)
  3. end)

So basically just make a new variable and do script.Parent.Door.ProximityPrompt > and I would think that would fix it.

Thank you for answering me. The script begins to work but weirdly.
Here my new script :


With this script I can only push the door, each time I press F, it pushes the door a few centimers. What should I fix?
(I fixed the word “Open” in “Opened” , the script works the same

Just from a quick glance it might be the number you’re increasing it by is too low. Try either making the number bigger or increasing the loop size. Assuming you don’t know what that means you can try changing > for i = 1,22 < change 22 to a higher number or where it says

Hinge.CFrame*Cframe.Angles(0, math.rad(4) < you can try changing that 4 to a higher number too. Of course thats just from a quick glance and I would suggest putting a few prints in between lines to make sure everything is working as intended.

Thank you again it works better and better but my script still have a problem : image


The door refused to close, it goes back to opened mode

Okokok let me see.

local Proxy = script.Parent.Door.ProximityPrompt
local Hinge = script.Parent.Hinge
local opened = false

Proxy.Triggered:Connect(function()
     if Proxy.ActionText == 'Opened' and opened == false then
          for i = 50, 85 do
               script.Parent:SetPrimaryPartCFrame(Hinge.CFrame*CFrame.Angles(0, math.rad(4), 0))
               wait()
               Proxy.ActionTest = 'Closed'
               print('The door is closed')
          end
       elseif Proxy.ActionTest == 'Closed' and opened == true then
            for i = 50, 85 do
                 script.Parent:SetPrimaryPartCFrame(Hinge.CFrame*CFrame.Angles(0, math.rad(-4), 0))
                 wait()
                 Proxy.ActionTest = 'Opened'
                 print('The door is opened')
              end
       end
       opened = not opened
end)

Omg that took so long to type xd. Please for everyones sake just post the code next time itll be so much easier to help. But try this and see if this does anything. Also fix any grammar issues in the code if one should appear. and by post the code I mean put it in here instead of a screen shot

Okay thank you for trying to help me.
I fixed the word ActionTest in ActionText but the door doesn’t work anymore.
My output said nothing about the script.
Here your script that I fixed in sentence.
If you need my script in letter, please ask me, I didn’t expect you needed it.

local Proxy = script.Parent.Door.ProximityPrompt
local Hinge = script.Parent.Hinge
local opened = false

Proxy.Triggered:Connect(function()
     if Proxy.ActionText == 'Opened' and opened == false then
          for i = 50, 85 do
			script.Parent:SetPrimaryPartCFrame(Hinge.CFrame*CFrame.Angles(0, math.rad(4), 0))
			wait()
			Proxy.ActionText = 'Closed'
			print('The door is closed')
			end
		elseif Proxy.ActionText == 'Closed' and opened == true then
		for i = 50, 85 do
			script.Parent:SetPrimaryPartCFrame(Hinge.CFrame*CFrame.Angles(0, math.rad(-4), 0))
			wait()
			Proxy.ActionText = 'Opened'
			print('The door is opened')
			end
		end
	opened = not opened
end) ```

Here my original script which works better than your :

local Proxy = script.Parent.Door.ProximityPrompt
local Hinge = script.Parent.Hinge
local opened = false

Proxy.Triggered:Connect(function()
	if Proxy.ActionText == "Opened" and opened == false then
		opened = true
		for i = 50, 85 do
			script.Parent:SetPrimaryPartCFrame(Hinge.CFrame*CFrame.Angles(0, math.rad(4), 0))
			wait()
			Proxy.ActionText = "Closed"
			print("The Door is closed")
		end
	end
	opened=false
	for i = 50, 82 do
		script.Parent:SetPrimaryPartCFrame(Hinge.CFrame*CFrame.Angles(0, math.rad(-4), 0))
			wait()
		    Proxy.ActionText = "Opened"
		    print("The Door is opened")
	end
end) ```
1 Like

Okok sorry I’m like trying to figure this out, cuz I just got back to roblox and this is a whole new service lmao. Been reading around some other posts and heres a few I have to offer.

Prompts+ - Easily customize ProximityPrompts - Resources / Community Resources - Roblox Developer Forum
Proximity Prompt Studio Beta - Updates / Announcements - Roblox Developer Forum

Like I would have to spend some time seriously playing around with this service and I don’t wanna just keep giving you dead ends. Like idk if its still in beta and you have to have the beta service enabled, idk if its like a click detector thing or if theres multiple uses. Theres just so much to cover in this. One thing that does stand out is in every proximity prompt function they have a player argument inside so that could just be the only thing thats missing. To be honest prior before this service the go to thing would be run service > Theres plenty of videos all over youtube on that and it would probably be way easier to go with run service than trying to figure this out. Of course thats just me > I’m more surprised no one else has come to try and help yet q.q Sorry man whish I could do more for ya.

Thank you for spending your time for trying to help me.
I’ll continue to search.
I don’t think I’ll find a Youtube video showing the solution to my problem but I’ll continue to search.

Maybe it’s your loop? try using tweenservice

Have you read my script? I’m using TweenService and that’s not the actual problem. Actually I can open the door, but when the door is opened, it doesnt want to be closed.

Where are you using tweenservice?

Sorry I forgot to mention I’m using CFrame, I don’t think I need to use TweenService, I’m searching a way to end my loop when the door is opened.

When the door is opened,you can use break in the loop.

Can you tell me which part of the script I should modify for this?

for i = 50, 85 do
script.Parent:SetPrimaryPartCFrame(Hinge.CFrame*CFrame.Angles(0, math.rad(-4), 0))
wait()
Proxy.ActionText = ‘Opened’
if script.Parent.PrimaryPart.CFrame == “the cframe you want” then
break
end
end

Um… when i tried your script the door flew everywhere.

Not for me. I used the line of script that you gave me, and the door still continue to use the bad CFrame after being in “Opened” mode

Here the actual script with your line added :

local Proxy = script.Parent.Door.ProximityPrompt
local Hinge = script.Parent.Hinge
local opened = false

Proxy.Triggered:Connect(function()
	if Proxy.ActionText == "Closed" and opened == false then
		opened = true
		for i = 50, 85 do
			script.Parent:SetPrimaryPartCFrame(Hinge.CFrame*CFrame.Angles(0, math.rad(4), 0))
			wait()
			Proxy.ActionText = "Opened"
			print("The Door is opened")
		end
	end
	   opened = false
	for i = 50, 85 do
		script.Parent:SetPrimaryPartCFrame(Hinge.CFrame*CFrame.Angles(0, math.rad(-4), 0))
		wait()
		Proxy.ActionText = "Closed"
		if script.Parent.SetPrimaryPartCFrame == (Hinge.CFrame*CFrame.Angles(0, math.rad(4), 0)) then
			break
		end
		end
	end)

The door still continue to go back in “Opened” mode, your break does nothing