Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make a wall that disappears randomly when at a distance?

In my game I want to make a special maze where the walls will randomly change depending on the distance of a player. In other words: If a player is X amount from the object it causes a randomiser to generate a X% chance for the wall to be invisible + not solid but won't happen if a player is X amount close to the object. Please tell me how to do this because it has been bothering me for ages.

1 answer

I think a good way to do this is using Magnitude which detects the distance between two objects so it would look something like this, more information in Roblox Developer website -- https://developer.roblox.com/en-us/articles/Magnitude.

local Distance = (OriginMostLikelyPlayerHead.Position - MazeWall.Position).Magnitude

-- I don't think the way its put will affect final results though you may have to test around with it!


print(Distance)
 -- This should give you the distance between both objects

This discussion is preserved as it was. New answers, comments, and votes are closed.