ProximitySignal - Fire an event when the LocalPlayer goes within a certain proximity of a BasePart

Take a copy here: ProximitySignal - Roblox

I made this for when you want to listen for when the LocalPlayer’s character goes within a certain proximity of a BasePart, and when (s)he leaves that proximity. It doesn’t do anything else so it’s only 70 lines. In my testing, I could create up to 10,000 ProximitySignals without a noticeable performance impact. If you want more functionality I would suggest ZonesPlus.

Usage example in a LocalScript (place ProximitySignal in ReplicatedStorage and place a SpawnLocation in the workspace):

local ProximitySignal = require(game.ReplicatedStorage.ProximitySignal)
local spawnSignal = ProximitySignal.new(workspace:WaitForChild("SpawnLocation"), 10)
spawnSignal.LocalPlayerEntered:Connect(function()
	print("LocalPlayer is within 10 studs of the SpawnLocation")
end)

spawnSignal.LocalPlayerExited:Connect(function()
	print("LocalPlayer is no longer within 10 studs of the SpawnLocation")
end)

If you find any issues please let me know by posting on this topic.

4 Likes