#SurfaceGUI dissapearing when you get far from it's proximity.

1 messages · Page 1 of 1 (latest)

ripe hawk
#

Hey guys so if I wanted to make it so the SurfaceGui dissapears if I walk more than 50 studs away, how would I be able to script that? Becaus currently, my script is not working.

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

local player = Players.LocalPlayer

local surfaceGui = script.Parent
local part = surfaceGui.Parent
local ContentHolder = surfaceGui.ContentHolder
local uiSize = ContentHolder.UIScale

RunService.RenderStepped:Connect(function()
local character = player.Character
if character then
local humanoid = character:FindFirstChild("Humanoid")
if humanoid then
local distance = (humanoid.Position - part.Position)
if distance > 10 then
uiSize.Scale = 0
else
uiSize.Scale = 1
end
end
end
end)

jaunty ocean
#

localscripts dont run in the workspace

#

dont use ai pls

ripe hawk
ripe hawk
jaunty ocean
#

yes

#

with changes to the surfacegui variable