Help on Player Screen Overlay Script

So I want a region(a big invisible part) to clone an image label I’ve made(stored in a folder) and carry it to the players gui when you’re inside said region.

I’m new to scripting so keep that in mind

I don’t know how to script the logic for sensing when the player is inside the part, and when they aren’t.
The reason for sensing if they aren’t inside the region is so I can destroy the overlay clone.

this is in a local script by the way.

heres the code I currently have:

local static = game.StarterGui.Overlays.Static

local ps = game:GetService("Players")

local overlayGui = ps.LocalPlayer.PlayerGui:WaitForChild("Overlay")

-- idk what to do instead of onTouched, since I'm still learning lua

function onTouched(part)

local nStatic = static:Clone()

nStatic.Parent = overlayGui

-- I need an else condition as well, but I still dont know how to do that lol




To help you check if a player is within a part, or a certain distance of a part you could make use of this

This would allow you to get a number showing the distance between the player and that part.

1 Like