I'm trying to make a billboard gui show up when you get near a specific npc, however, i cant even figure out how to detect when the player moves. I can't seem to figure out what i'm doing wrong, the error is
Players.Galaxybombboy.PlayerGui.LocalScript:7: attempt to index nil with 'Changed'
and the script is
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local rockman = workspace["Rock Man - Shop Keeper"]
local rockhumroot = rockman:FindFirstChild("HumanoidRootPart")
character:FindFirstChild("HumanoidRootPart").Changed:Connect(function()
if (character:FindFirstChild("HumanoidRootPart").Position - rockhumroot.Position).Magnitude < 50 then
print("working")
end
end)
What am i doing wrong?

1 comment
Use GetPropertyChangedSignal And Replace HumanoidRootPart With Head