howdy roblox devs! does anyone know why the heck my gui isn’t displaying on this part? i’m trying to make an npc suspicion system and i really have no idea why it’s not displaying, maybe this is a dumb question. anyways here’s a pic of what is generated during the game:
(it’s the little black bar beneath the npc) and here’s the part of the script making the bar:
local NPC = script.Parent
local head = NPC:WaitForChild("Head")
local rootPart = NPC:WaitForChild("HumanoidRootPart")
local detectionRange = 50 -- Adjust the detection range as needed
local fieldOfViewThreshold = 0.5 -- Adjust the field of view threshold as needed
local suspicionAmount = 0
local suspicionMeter = Instance.new("Part")
suspicionMeter.Size = Vector3.new(7.5, 0.25, 0.5)
suspicionMeter.BrickColor = BrickColor.new("Really black")
suspicionMeter.CanCollide = false
suspicionMeter.Position = rootPart.Position + rootPart.CFrame.UpVector * -2.875 + rootPart.CFrame.LookVector * 1.5
local susGui = Instance.new("SurfaceGui")
susGui.Face = Enum.NormalId.Top
susGui.Parent = suspicionMeter
local susFrame = Instance.new("Frame")
susFrame.Size = UDim2.new(0,0,0,0)
susFrame.BackgroundColor3 = Color3.new(255,255,0.3)
susFrame.Parent = susGui
local susWeld = Instance.new("WeldConstraint")
susWeld.Part0 = suspicionMeter
susWeld.Part1 = rootPart
susWeld.Parent = suspicionMeter
suspicionMeter.Parent = NPC
any help is appreciated! also if anyone has ideas on how to make a unique and cool detection system i would love to hear it! whether it’s using parts for detection or rays or something else i’d like to hear your take on things!
ps i have confirmed that the problem is with the gui or frame, not the part