So i tried making a overheadgui so that whenever the player leaves a zone and their boolvalue is false they would get a overheadgui saying “UnAuthorized”, but if the players value is true then they would get an overheadgui saying "Authorized.
This didnt work as it didnt show up. No errors in the output. No nothing. i put the script insdie the zone and it is a serverscript.
Here is the script.
local Zone = script.Parent
function onPartTouched(part)
local player = Players:GetPlayerFromCharacter(part.Parent)
if player then
local IsAuthorized = player:FindFirstChild("IsAuthorized")
if IsAuthorized and IsAuthorized.Value == true then
local gui = Instance.new("BillboardGui")
gui.Parent = player.Character.Head
gui.Size = UDim2.new(0, 200, 0, 50)
gui.StudsOffset = Vector3.new(0, 2, 0)
local label = Instance.new("TextLabel")
label.Parent = gui
label.Text = "Authorized"
label.Font = Enum.Font.Code
label.FontSize = Enum.FontSize.Size24
label.TextColor3 = Color3.fromRGB(0, 255, 0)
label.BackgroundTransparency = 1
gui.Enabled = true
else
local gui = Instance.new("BillboardGui")
gui.Parent = player.Character.Head
gui.Size = UDim2.new(0, 200, 0, 50)
gui.StudsOffset = Vector3.new(0, 2, 0)
local label = Instance.new("TextLabel")
label.Parent = gui
label.Text = "Unauthorized"
label.Font = Enum.Font.Code
label.FontSize = Enum.FontSize.Size24
label.TextColor3 = Color3.fromRGB(255, 0, 0)
label.BackgroundTransparency = 1
gui.Enabled = true
end
end
end
function onPartLeft(part)
local player = Players:GetPlayerFromCharacter(part.Parent)
if player then
local gui = player.Character.Head:FindFirstChild("BillboardGui")
if gui then
gui:Destroy()
end
end
end
Zone.Touched:Connect(onPartLeft)
Zone.TouchEnded:Connect(onPartTouched)```