I rechecked the parameters for tweening, they seem to be correct I can’t seem to find a solution any suggestions?
Error: on line 11
Code:
local gui = script.Parent.Parent
local frame = script.Parent
local slider = frame.slider
local page = frame.page
for i,object in pairs(frame:GetChildren()) do
if object:IsA("TextButton") then
object.Text = object.Name
object.MouseButton1Click:Connect(function()
-- Error below ↓
slider:TweenPosition(UDim2.new(object.Position.X, object.Position.Y + 0.026),Enum.EasingDirection.Out, Enum.EasingStyle.Elastic,0.5,true)
end)
end
end
The output prints the same error, “invalid argument #2 (UDim expected, got number)”, whether it is UDim2.fromOffset or UDim2.fromScale (which I am utilizing).
local gui = script.Parent.Parent
local frame = script.Parent
local slider = frame.slider
local page = frame.page
for i,object in pairs(frame:GetChildren()) do
if object:IsA("TextButton") then
object.Text = object.Name
object.MouseButton1Click:Connect(function()
slider:TweenPosition(UDim2.fromScale(object.Position.X, object.Position.Y + 0.026),Enum.EasingDirection.Out, Enum.EasingStyle.Elastic,0.5,true)
end)
end
end
Error, Line 11
invalid argument #2 (UDim expected, got number)
I figured out the solution when I tried to add 0.026 to the Y position I was trying to add it to both values of Y, scale, and offset so instead I wrote. object.Position.Y.Scale to get add the scale value.