How i can move frame in it's front direction?

Hi, i’m wan’t to make a frame that moves towards it front but it’s hard to define where is the front of the frame and then move that direction by number,
Zrzut ekranu 2023-03-15 190818
this is what i try to do, i’m wan’t to move this frame by this arrow direction by number , anyone know how to do this?

1 Like

made a script based on some scratch wiki, but it wont go in that direction in the photo if the part was rotated 75 degrees (just do some trial and error to fit the best rotation)

local Steps = 5

while task.wait(1) do
	local Direction = Vector2.new(math.cos(math.rad(script.Parent.Rotation)),math.sin(math.rad(script.Parent.Rotation)))
	script.Parent.Position = UDim2.new(0,script.Parent.AbsolutePosition.X + Direction.X * Steps,0,script.Parent.AbsolutePosition.Y + Direction.Y * Steps)
end


scratch wiki: Move () Steps (block) - Scratch Wiki (scratch-wiki.info)

2 Likes