UI Elements always "Index nil"

Hey! I’ve been scripting for years, and I’ve never quite figured out why this happens. It seems that whenever I call a UI element, no matter what :FindFirstChild() or :WaitForChild() the element almost ALWAYS shows up as “nil”:

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

local Minimap = script.Parent.Minimap
local Arrow = Minimap:WaitForChild("Arrow")

RunService.Stepped:Connect(function()
	wait()
	Arrow.Rotation = LocalPlayer.Character:FindFirstChild("HumanoidRootPart").Orientation.Y
end)

^^ Just a quick example, and whenever this is ran it’ll show in the output:

(:FindFirstChild() and .Arrow will return “Attempt to Index Nil”)

If you guys have any idea why this happens, please tell me.

Screen Shot 2021-06-18 at 8.07.05 AM

Minimap isn’t parented to Client, it’s parented to the Interface GUI

1 Like

:slap:

grumbles in frustration

thanks ;-;

1 Like