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

Is there a event to check if a Player is far away enoug?h for dialogue?

So I have a script that makes a GUI Pop up when you press a dialogue

the problem was that I wanted the GUI dissapear when the player is too far from the dialogue

is there any way?

1 comment

0

Try using ".magnitude", it works for many things like u re asking

1 answer

-- // Local script
local plr = game.Players.LocalPlayer
local part = -- // Target part
local max = -- // Max distance
local dialogue = -- // Dialog
while wait() do
	if (plr.Character.HumanoidRootPart.Position - part.Position).magnitude <= max then
		dialogue.Visible = true
	else
		dialogue.Visible = false
	end
end

This should work.

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