I cant get my script to recognise HumanoidRootPart, I don't know if I'm messing up the Player variable, Character variable, or whatever. But it's like my character model doesnt have a humanoid root part (it does though?) anyone know whats going on?
Local Script (Location is StarterGui)
local Player = game.Players.LocalPlayer local Character = Player.Character or Player.CharacterAdded:Wait() local HumRoot = Character:FindFirstChild("HumanoidRootPart") local ShopMan = workspace["Rock Man - Shop Keeper"] local ShopRoot = ShopMan:FindFirstChild("HumanoidRootPart") while true do if (HumRoot.Position - ShopRoot.Position).Magnitude < 30 then print("works") else print("nah not working") end wait() end
Error
Players.Galaxybombboy.PlayerGui.LocalScript:8: attempt to index nil with 'Position'
I think my studio is just broken, but that wouldnt make sense
Use WaitForChild() instead of FindFirstChild()