Unable to cast string to token

Hi everyone! I’m trying to create a script that tweens a ImageGui when I press tab.
But when I press tab it says Unable to cast string to token in the line 9
Here’s the script:

local TweenObj = script.Parent
local InputService= game:GetService("UserInputService")

local debounce = false
InputService.InputBegan:Connect(function(InputObject, Processed)
	if InputObject.KeyCode == Enum.KeyCode.Tab then
		if debounce then return end
		debounce = true
		TweenObj:TweenPosition(UDim2.new(0.767, 0), 'Out', 'Smooth', '1')
		wait(1)
		debounce = false
	end
end)
1 Like

change UDim2.new to UDim2.fromScale and also it isnt strings but rather enumerables. Like out becomes Enum.EasingStyle.Out iirc, you will know based on the intellisense the ide provides

1 Like

Smooth is not a valid EasingSytle and you’re defining the time as a string, not as a number.

See: EasingStyle | Roblox Creator Documentation

1 Like