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?
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?
-- // 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.
1 comment
Try using ".magnitude", it works for many things like u re asking