Moving walls w/o sight

I’m fairly new at programming on roblox, but I’m trying to make a game that needs it. I need to create a maze kinda place where walls move sometimes, but only if the no one is looking at it. Thanks!

1 Like

You could use raycasts

I think thats a bit too complicated if you’re new to programming.
You’d have to check each wall piece every few seconds using raycasts, and then move the walls in a pre-programmed way if they are not rendered on screen.

Alternatively you could check if the player is in range of wall pieces, and if he is far away that means he cant possibly look at it.

This would only work if your map doesn’t have big open spaces, and also it would be unprecise.

They said it’s a maze though… I feel like raycast is almost the only way.
Plus everyone has different graphic settings, players with low settings wouldn’t have it move even if they can’t see it

You could use a moving part however it would be a very complicated moving part

You’ll need to know the basics of Roblox Lua programming and a few other things under Roblox’s API like raycasting like @Azul_Litt suggested.

Accomplishing most “if player is looking at” type functions requires knowledge on vectors, CFrame, and magnitude. Information on these subjects can be found on the Roblox Developer Hub or tutorials on YouTube. (e.g. this advanced scripting playlist)

I’ve heard of raycasting, but never tried it. Thanks for the help!

Also is it possible to do it without raycasting or is that the only way?

Mazes can have big open spaces.

It’s the best way, you’ll get the best results from it, the link I sent also explains raycasts on where a player is facing, you could try what @realschnappi said though if you don’t want to use raycasts.