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 5 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 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
01-- // Local script
02local plr = game.Players.LocalPlayer
03local part = -- // Target part
04local max = -- // Max distance
05local dialogue = -- // Dialog
06while wait() do
07    if (plr.Character.HumanoidRootPart.Position - part.Position).magnitude <= max then
08        dialogue.Visible = true
09    else
10        dialogue.Visible = false
11    end
12end

This should work.

Ad

Answer this question