Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why does it say "Unable to cast token to token"? [SOLVED]

I made a script that moves a frame up out of the screen. My code doesn't seem to be wrong but I get this error: "Unable to cast token to token" and I'm not sure what it means by that.

Here is the local script:

local button = script.Parent
local infoFrame = button.Parent.Parent.Parent.Parent.Info
local welcomeFrame = button.Parent.Parent.Parent
--//Script
button.MouseButton1Click:Connect(function()
	welcomeFrame:TweenPosition(UDim2.new(0.186, 0,-1, 0), Enum.EasingStyle.Elastic, Enum.EasingDirection.InOut, 1)
	wait(1)
	infoFrame:TweenPosition(UDim2.new(0.179, 0,0.054, 0), Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 1)
end)

This is my explorer.

Thank you for your time and I appreciate any answers.

1 answer

I found the answer myself. I got the EasingStyle and EasingDirection the wrong way around It should be like this:

local button = script.Parent
local infoFrame = button.Parent.Parent.Parent.Parent.Info
local welcomeFrame = button.Parent.Parent.Parent
--//Script
button.MouseButton1Click:Connect(function()
    welcomeFrame:TweenPosition(UDim2.new(0.186, 0,-1, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Sine, 1)
    wait(1)
    infoFrame:TweenPosition(UDim2.new(0.179, 0,0.054, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Sine, 1)
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.