How do I stop players moving their camera through windows?

I am currently making a room where there is a window with a button on the other side that opens a door. But I noticed players can move their camera through the window and open the door that way. I have tried changing the material and even putting decals on it so they cant see through but they can still get the camera inside. Is there any way to fix this?

6 Likes

So do you want the players to look threw the window?

Cause if that is the case what you can do is put an invisible part infront of the button do th err can’t click it.

What, I am getting is that you don’t want the players to look through a window. Which is represented by a diagram of what I’m thinking the problem is.


578fabaa3c13178a7ddef1a7ca033583

I would recommend turning down the Players CamerMaxZoomDistance into a variable like 30 - 60 which will prevent them from looking at far distances.
If you want this solution, follow these steps:

Select StarterPlayer:
image

Go to Properties, and select CamerMaxZoomDistance under the Camera Tab.
image
It’s normally set to 128 so you can write any number that fits your maximum view distance.
Recommended: 30 - 60


Disabling Shift Lock at your game. This would prevent the player from doing something like this:
ShiftLockDemonstration

The player will not be able to see through walls, normally. They can still see walls, but not as good as when they had Shift-Lock. It makes it harder for players. How can you disable it?

It’s very simple! Create a Script on Workspace.
Then insert this inside the Script:

game.StarterPlayer.EnableMouseLockOption = false

This is a very simple script, but it’s very effective.


75953edcf4340f5b3d2352e53f52c9c4

The third solution would be to make the Window’s Transparency to 0. This is not a very effective solution but it kind of works.

After that, you should add another layer of walls, or thicken the exterior walls surrounding the Room.
That would help out a ton when it comes to players not getting to hover their cameras through.

Then, you can lower down the ClickDetector Maximum Activation Distance, by going to Properties, and setting it to lower than 32.

Recommended Maximum Activation Distance: 8 - 12
image


e0a92960e9ae430c3064d0351244333a

This is a last-resort thing, if nothing works. But, it might ruin the gameplay.

  • You can make it FirstPerson, by changing it from StarterPlayer, and Lock it to FirstPerson:
    image

  • You can change the button’s location to a harder spot for the people that are inside to hover their camera.

  • Make sure CanCollide is set to true.
    image

Check out these for more information:
Customizing the Camera (roblox.com)
Camera Manipulation (roblox.com)
Camera (roblox.com)
StarterPlayer.CameraMaxZoomDistance (roblox.com)
StarterPlayer (roblox.com)
BasePart.CanCollide (roblox.com)
Camera.FirstPersonTransition (roblox.com)

If nothing was helpful please reply back to me! :happy2:


5 Likes

What material are you using? And what other material did you try? I made a see-through top for my maze that players can’t zoom out through.(to block the top down maze view) I don’t remember what material I used though.

Okay, I see what I did. Its not the material, its the transparency that determines if they can zoom their camera through a part.

The magic number is .25, if the part is .25 or greater transparency its zoom through.

Problem is, glass gets kinda hard to see through at that level, so in my game I used a forcefield material. The forcefield is still very clear under .25 transparency. Maybe that will work for you too.

Maybe you could even combine materials and have a layer of each, one for the glass look and one(forcefield layer) to block the camera

2 Likes

That doesn’t make sense. How people inside can press the button?

1 Like

Well when they zoom their camera through the window, their view and their mouse pointer is now outside, looking at the button.

I mean, the players inside the building can’t press that button cause there’s a invisible part. That according to what @oceandragon25 proposed.

1 Like

That was his suggestion, he wasn’t the OP and the OP didn’t say if he tried that and whether it worked for him or not.

It is pure logic, I am only saying that it not gonna work because by simple logic it cannot work, nothing more, he can try anyway.

I think if he sets his window part transparency to less than .25 then it will solve his problem. He must be afk.

You put it infront of it so the players inside can press it from the sides

1 Like

It is a solution but I think it would be uncomfortable to pressure for the players.

You can try to use proximity promp, disabling “shiftlock” on players and thicken the walls by making the interaction range the minimum so that outsiders cannot interact (I don’t know how to avoid that using scripts, sorry).

Hi there :wave:t4:,

I also had this problem a long time ago.
In the end, I found a simple trick with which you can prevent players from looking through windows.
https://gyazo.com/0d2401aaedc8868b26389c0ee8dfa154

You can use for that a Bug in Roblox, which allows any Neon Material to be invisible in Glass.
To do this, first, take a glass pane and set the transparency to at least 0.5 or higher. Clone the part and make it smaller so that it is now in the window part. Change the material to neon and set the transparency to 0.1. Tada, now a player can’t see through with the camera. (Provided, of course, that Shift-Lock is deactivated).

Clone the block, make sure the Transparency is set to 0, and CanCollide is set to false. Next insert a “BlockMesh” and set the scale value of the mesh to 0,0,0

Helpful Graphics!

image
image

Result:

1 Like

Thanks for the help everyone. Sorry it took so long for me to respond, I didn’t think I would get a response this fast.