I have a tool shop, and when you get within a certain radius (represented by an invisible part), a GUI will appear to prompt you to enter the shop. However, I can’t figure out how to remove the GUI once the player is not longer on top of that part. I’ve tried .TouchedEnded
, but it works in very strange ways while on top of the part.
using magnitude would be the easiest way to do this
localscript in startercharacterscripts
task.wait(2)
local ShopPart = workspace.ShopPart --// change this
local Root = script.Parent:WaitForChild("HumanoidRootPart")
while true and task.wait(0.1) do
if (Root.Position - ShopPart.Position).Magnitude <= 12 then --// 12 is the radius in studs from the part then
--// show the ui
else
--// hide the ui
end
end