Door Proximity Prompt + Camera glitching

So in my game you can lock door to delay the other people and I found out that they can just glitch their camera through like this

(It doesn’t work with normal freecam cause I have invisible wall to block it)

Is there a way to fix this? Require line of sight is on, but I think it only works with camera, not the character itself

1 Like

Instead of making sure the other team can’t open the door through glitching, make it so they can’t trigger or see the proximity prompt. You can do this by using a local script to disable the prompt and using a regular script to detect if the team they are on can open it.

1 Like

I’m assuming the other players on the same team as the person who locked the door can unlock it, couldn’t you simply check if the player trying to unlock the door is on the same team as the person who locked it? Glitching or not, if they’re not on the same team as the team that locked the door, they wouldn’t be allowed to open it.

1 Like

I shouldn’t have said “other party/team” but instead “other person”. All o the players should be able to open/close/lock the door

1 Like

In the script that handles the locking system, couldn’t you grab the player’s id to then check if anybody trying to unlock it is the same person who has locked it? Since nobody has the same id as the player who locked it, no matter how they’ve seen the “Lock” proximity prompt they have no way of unlocking it, ofc without being the person who has locked it.

I made this, haven’t tested it yet, but you get the point.

local openPrompt = script.Parent.OpenPrompt
local lockPrompt = script.Parent.LockPrompt

local isLocked = false
local plrWhoLocked = 0 -- Safe to say "0" since nobody has that UserId.

openPrompt.Triggered:Connect(function(plr)
	if isLocked then
		-- Locked code.
	else
		-- Unlocked code.
	end
end)

lockPrompt.Triggered:Connect(function(plr)
	if isLocked then
		if plr.UserId == plrWhoLocked then
			-- Unlocks the door if the plr who locked it is the one who triggered the prompt.
			isLocked = false
			plrWhoLocked = 0
		end
	else
		-- If the door isn't locked then.
		isLocked = true
		plrWhoLocked = plr.UserId
	end
end)

I’ve read what you said again and well the code now does seem pointless, yet the camera isn’t bugged, that’s how the Roblox camera works, you can’t fix that issue, as far as I know anyway. So best thing to do is implement what I’ve made and then live with the “camera glitching”.

This fixed the main problem you have anyway of other players being able to unlock the door, as all this does is stop them unless they’re the ones who have locked it or the door was never locked.

1 Like

Wait, I might have completely read this wrong, are you asking to stop players from unlocking the door from the outside? For themselves and everybody else I mean.

Detect what side the player is on using below:
I have seen that sometimes when standing next to the door, then it can decide the side properly.
If this doesn’t work, then just compare positions, or turn of shift lock entirely.

Then make the lock prompt visible if the player is on the side of the lock.

local char = plr.Character
local doorToChar = char.HumanoidRootPart.Position - doorOrigin.Position 
local doorLookVect = doorOrigin.CFrame.lookVector

if doorToChar:Dot(doorLookVect) > 0 then -- might be reversed
	-- behind
else
	-- front
end
1 Like

I’ll try this//////////////////