I’m making a script to a part allways stay behind 2 studs of the player, but It’s not working, saying: attempt to index nil with ‘HumanoidRootPart’
Script:
game.Players.PlayerAdded:Connect(function(plr)
wait(1)
local part = game.ReplicatedStorage.Part:Clone()
part.CanCollide = false
part.Parent = plr.Character
while true do
wait()
part.CFrame = plr.Character.HumanoidRootPart.CFrame
part.CFrame = part.CFrame + plr.Character.HumanoidRootPart.CFrame.LookVector * -2 + Vector3.new(0,2,0)
end
end)