Ive used some code I wrote and It doesn't seem to work, can anybody help me out?
heres my non-working code incase you are wondering: script.Parent.MouseButton1Click:Connect(function() script.Parent.Store.ScrollingFrame.CanvasPosition:TweenPosition(UDim2.new(0, 0), Enum.easingDirection.InOut, Enum.easingStyle.linear, 0.5) end)
[PLEASE MARK THIS ANSWER AS ACCEPTED IF IT WORKS]
To tween canvas position, you do not use :TweenPosition(), instead you tween it like you would with any other Vector2 property.
script.Parent.MouseButton1Click:Connect(function() local TweenService = game:GetService("TweenService") local scrollingframe = script.Parent.Store.ScrollingFrame local goal = {} goal.CanvasPosition = Vector2.new(0, 0) local tweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut) local tween = TweenService:Create(scrollingframe, tweenInfo, goal) tween:Play() end)
You don't use UDim for CanvasPosition or TweenPosition. To achieve the same result you will want to use TweenService.
For example, to move the canvas down you would do this:
local tweenService = game:GetService("TweenService") local canvas = script.Parent.Store.ScrollingFrame script.Parent.MouseButton1Click:Connect(function() tweenService:Create( canvas, TweenInfo.new(0.2), {CanvasPosition = canvas.CanvasPosition + Vector2.new(0, 20)} ):Play() end)