local image = script.Parent.CanvasGroup.Straightline – Anchorpoint is 0.5,0.5
local heartfolder = script.Parent.CanvasGroup.Heartbeat – Just a folder
local function positioning(angle)
-- Line1
local line1 = image:Clone() -- Anchorpoint is 0.5,0.5
line1.Parent = heartfolder
line1.Rotation = angle
line1.ImageTransparency = 0
-- Center position of line1
local midX = line1.Position.X.Scale
local midY = line1.Position.Y.Scale
-- Size of line1
local halfWidth = line1.Size.X.Scale / 2
local halfHeight = line1.Size.Y.Scale / 2
-- Calculating the corner position of line1
local cornerX = midX + halfWidth
local cornerY = midY + halfHeight
local originX = cornerX - midX
local originY = cornerY - midY
-- Calculating the rotated position of the corner
local radian = math.rad(angle)
local rotatedX = originX * math.cos(radian) - originY * math.sin(radian)
local rotatedY = originX * math.sin(radian) + originY * math.cos(radian)
-- Line2
local line2 = image:Clone() -- Anchorpoint is 0.5,0.5
line2.Parent = heartfolder
line2.Name = "Line2"
line2.ImageTransparency = 0
-- Set the position of line2 at the rotated corner position
line2.Position = UDim2.new(rotatedX + halfWidth, 0, rotatedY + halfHeight, 0)
end
wait(5)
positioning(45) – Example with a 45-degree angle
– This is the script. I checked Forum and found a useful one, but still I am messing up so I used ChatGpt for the problem. But still failed please help me.