Ok, so I was trying to make it so when you click the button, the frame comes out of the screen smoothly by using TweenPosition.
It somehow shows an error in this simple script.
local mainround = script.Parent.Parent.Parent.Parent.MainRoundify script.Parent.MouseButton1Click:Connect(function() mainround:TweenPosition( UDim2.new(-3.5, 0,0.605, 0), 1, "In", "Quad", false ) end)
Where is the script located at?
The script is located in the StarterGui inside of a Round frame
What type of script?
It is a server script, the normal script we use.
The error it shows on the output says:
Unable to cast string to token
The erroring line is
What did you do to try and fix it?
I tried removing the other script that was inside the TextButton, tried putting it in a local script rather than a server script. I removed some code lines that was inside the script and those were:
local function ShowGui() mainround:TweenPosition( uDim2.new(0.501, 0,0.605, 0), 1, "In", "Quad", false ) end
Thanks so much if you answered, I'm fully patient.
Alright so there are a few errors in your script.
.1 You dont use scripts for Client side, instead use local scripts.
.2 Your setting the time first, and thats wrong, do this instead:
mainround:TweenPosition(UDim2.new(-3.5, 0,0.605, 0), "In", "Quad", 1, false)
Always follow this style for UDim2 Tweens: https://developer.roblox.com/en-us/api-reference/function/GuiObject/TweenPosition
Also, you could use UDim2.fromScale(scaleX, scaleY) instead of what your doing. Please vote this if it helped you.
There are a few issues I can see here.
Firstly, you need to use a LocalScript for tweening.
Secondly, you are receiving this error because your arguments are mismatched!
The correct order is:
Direction, Style, Time, True/False
Here is your fixed code!
local function ShowGui() mainround:TweenPosition( UDim2.new(0.501, 0,0.605, 0), 'In', 'Quad', 1, false) end
I also tried this out with a script of my own, here is the code for that!
local tween = 1 script.Parent.MouseButton1Click:Connect(function() if tween == 1 then script.Parent:TweenPosition(UDim2.new(0,1042,0,170), "In", "Linear", 1) tween = 2 elseif tween == 2 then script.Parent:TweenPosition(UDim2.new(0,328,0,698), "In", "Linear", 1) tween = 1 end end)
If you have further questions, you can ask me or check out the official DevForum post.