What is the issue? Whenever the Egg is too far away from the player it gives the error (Attempt to index nil with position)
What solutions have you tried so far? Ive looked around devforum but no one has the same problem
runService.RenderStepped:Connect(function()
if player:DistanceFromCharacter(v.EggMesh.PrimaryPart.Position) < MaxDisplayDistance then
if cantOpenBillboard == false then
billboardTemp.Enabled = true
animateBillboard(billboardTemp, true)
end
else
if cantOpenBillboard == false then
animateBillboard(billboardTemp, false)
end
end
end)
end
end
I assume you have enabled StreamingEnabled?
The reason it errors is because the egg is ‘unloaded’ and as such the script does not know that it exists, hence the error.
You can try to resolve this by checking if the egg exists first:
runService.RenderStepped:Connect(function()
if not v.EggMesh.PrimaryPart then return end
if player:DistanceFromCharacter(v.EggMesh.PrimaryPart.Position) < MaxDisplayDistance then
if cantOpenBillboard == false then
billboardTemp.Enabled = true
animateBillboard(billboardTemp, true)
end
else
if cantOpenBillboard == false then
animateBillboard(billboardTemp, false)
end
end
end)
end
end