UI Positioning isnt correct on WorldObject Position

Ok! It works now, it prints true everything working but for some reason it spawns randomly. But it still works

@Forummer can you tell me why it happening?

What do you mean by “it spawns randomly”?

1 Like


As you can see it.
(sorry for late reply, I just finish school)

Can I see the code which is setting the position of the part above the flower and the code which is converting that worldpoint to a screen point and then the bit where you call the function which sets the position of the UI object?

function CreateSun(x,y)
	local sun = game.Lighting.SunIcon:Clone()
	sun.Position = UDim2.new(x + sun.Size.X.Scale/2,sun.Size.X.Offset/2,y + sun.Size.Y.Scale/2,sun.Size.Y.Offset/2)
	print(sun.Position)

Here!

local newvector,insight = workspace.Camera:WorldToScreenPoint(object.Position)



print(insight)
print(VectorX:..newvector.X.. VectorY:..newvector.Y)
CreateSun(newvector.X,newvector.Y)

Mind sharing what is being printed?

1 Like

print(insight)
It prints the insight value (true or false from the worldtoscreenpoint)
print(sun.Position)
It prints the sun position so I can see where it is
print(x y smth)
It prints the value that is originated from the worldpoint

true - Server - Script:34
VectorX:0.29805094003677 VectorY:0.43589639663696 - Server - Script:35
{0.345050931, 0}, {0.535396397, 0}

Sorry for late replies