ProximityPrompt use for other functions such as in radius?


I’m currently experimenting with an artificial gravity generator, and im trying to use the new proximity prompt to determine if the player is in the radius… it works pretty well, except for when the player looks directly away from the direction of where the gravity generators center is… then it is classifying it as not in proximity, yet i have line of sight required off. Any advice? My goal with using this was to eliminate more needless loops.


Just make a invisible part with cancollide of, and check if it’s been touched.

1 Like

You could try making a run service scope that detects the player’s humanoidrootpart position from the object in question in a server script

-- example

runService.Heartbeat:Connect(function() -- heartbeat event
   local magnitude = (humanoidRootPart.Position - objectInQuestion.Position).magnitude -- magnitude between the player and object

   if magnitude <= RADIUS then -- check if the player's position is within the radius
       isWithinRadius = true -- the player is within radius
       isWithinRadius = false -- the player is not within radius

The reason he used ProximityPrompt was to eliminate loops though.

RunService isn’t really a “loop” it just fires every frame. Something like while true do would run every x amount of seconds regardless of the player’s framerate (if there’s a delay added)