How to fix that error?

08:14:44.001 Unable to cast TweenInfo to token - Client - LocalScript:22
script where that error

-- Gui
script.Parent.Parent.Team4.MouseButton1Click:Connect(function()
	Popups.TeamSwitch.Visible = false
	transition.Position = UDim2.new(1,0,0,0)
	transition:TweenPosition(UDim2.new(0,0,0,0), TweenInfo.new(.25, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 1, true))
	wait(0.25)
	Camera.CFrame = workspace.Menu.Cameras.LoadingFace.CFrame
	transition:TweenPosition(UDim2.new(-1,0,0,0), TweenInfo.new(.25, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 1, true))
	MainFrame.CurrentVersion.Visible = false
	wait(1)
	StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, true)
	game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
	MainFrame.CurrentVersion.Visible = false
	Menu.MenuMusic:Stop()
end)

What line is the error on? I need to know to fix the issue.

you don’t use TweenInfo for TweenPosition.

Do this and use

player.PlayerGui -- player is game.Players.LocalPlayer

So, how i can fix that error? (or ? )

Remove the TweenInfo from the tweenposition

transition:TweenPosition(UDim2.new(-1,0,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, 1, true)

or

local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 1, true)
local Tween = TweenService:Create(transition, tweenInfo, {Size = UDim2.new(-1,0,0,0})
Tween:Play()


The first one uses TweenPosition with the corrected parameters, and the second one uses TweenService to create a tween using the TweenInfo.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.