Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 4 years ago

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?

0
Try using ".magnitude", it works for many things like u re asking Shadic1270 136 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
-- // 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.

Ad

Answer this question