Hello devs!
I wanted to do module for idk how right name it “damage circle system” but i got problem with camera rotation, you can see it on video.
I tryed to found some info about it but how you see i dont found anything like this
Here code which i writed to do this:
local MODULE = {}
local DamageCircles = {}
MODULE.CreateCircle = function(Position,DestroyTime)
local Circle = {}
Circle.Position = Position
Circle.DestroyTime = DestroyTime
local ImageLabel = Instance.new("ImageLabel")
ImageLabel.Parent = script.DamageCircles
ImageLabel.Name = "DamageCircle"
ImageLabel.Position = UDim2.new(0,script.DamageCircles.AbsoluteSize.X/2-script.DamageCircles.AbsoluteSize.X*0.07,0,script.DamageCircles.AbsoluteSize.Y/2-script.DamageCircles.AbsoluteSize.X*0.07)
ImageLabel.Size = UDim2.new(0,150,0,150)
ImageLabel.Image = "http://www.roblox.com/asset/?id=6508656481"
ImageLabel.BackgroundTransparency = 1
Circle.Label = ImageLabel
table.insert(DamageCircles,Circle)
end
game:GetService("RunService").RenderStepped:Connect(function(DT)
for Index,Circle in pairs(DamageCircles) do
if Circle.DestroyTime <= 0 then
Circle.Label:Destroy()
table.remove(DamageCircles,Index)
else
Circle.DestroyTime -= DT
--Here is problem:
Circle.Label.Rotation = 270+math.deg(math.atan2(((Circle.Label.AbsolutePosition.Y+Circle.Label.AbsoluteSize.Y/2)-workspace.CurrentCamera:WorldToScreenPoint(Circle.Position).Y),((Circle.Label.AbsolutePosition.X+Circle.Label.AbsoluteSize.X/2)-workspace.CurrentCamera:WorldToScreenPoint(Circle.Position).X)))
end
end
end)
return MODULE
Problem at end of script
Sorry for my grammar