#attempted to index nil with position on something clearly defined
15 messages · Page 1 of 1 (latest)
Size = 25
script.Parent.Size = Vector3.new(math.random(1,10) / Size,math.random(1,10) / Size,math.random(1,10) / Size)
while true do
wait()
if (script.Parent.Position - game.Workspace.CameraPos.Position).Magnitude > 512 then
wait()
script.Parent:Destroy()
end
if (script.Parent.Position - game.Workspace.CameraPos.Position).Magnitude < 50 then
wait()
script.Parent:Destroy()
end
end
this is the code
Workspace.Stars.Star.Script:9: attempt to index nil with 'Position'
it litarly says index nil with a script.Parent
you shure that CameraPos isnt nil?
the Player camera Would be
workspace.CurrentCamera.CFrame.Position
Size = 25
local CamPart = game.Workspace.CameraPos
script.Parent.Size = Vector3.new(math.random(1,10) / Size,math.random(1,10) / Size,math.random(1,10) / Size)
while script.Parent and wait() do
local dis = (script.Parent.Position - CamPart.Position).Magnitude
if dis > 512 or dis < 50 then
script.Parent:Destroy()
end
end
you prob need to add a :WaitForChild()