I don't see what the problem this script

I’m making something like a dash and I’m trying to move forward using tween service. However, please solve the problem that it does not work with the “Unable to cast to Dictionary” message.

local Slide = Instance.new("VectorForce")
		local A0 = Instance.new("Attachment", Char.HumanoidRootPart)
		Slide.RelativeTo = "World"
		Slide.Attachment0 = A0
		Slide.Force = Char.HumanoidRootPart.CFrame.LookVector * Vector3.new(SlideForce, 0, SlideForce)

		local T = Hum.Animator:LoadAnimation(SlideAnimation)
		T:Play()

		Slide.Parent = Char.HumanoidRootPart
		Slide.Enabled = true

		
		
		local tweenInfo = TweenInfo.new(0.0001, Enum.EasingStyle.Exponential, Enum.EasingDirection.InOut)
		local tween = game:GetService('TweenService'):Create(Slide, tweenInfo, { Char.HumanoidRootPart.CFrame.LookVector * Vector3.new(SlideForce, 0, SlideForce) })
		tween:Play()
		

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

In this line try to use this:

local tween = game:GetService("TweenService"):Create(Slide, tweenInfo, { Char.HumanoidRootPart.CFrame.LookVector * Vector3.new(SlideForce, 0, SlideForce) })
1 Like

You are trying to tween the VectorForce object, which is not a valid object to apply a Tween to.

Instead, you should be tweening a property of a valid object. Since you are applying force to the character, you can try tweening the Force property of the VectorForce object. Here’s the corrected code:

local Slide = Instance.new("VectorForce")
local A0 = Instance.new("Attachment", Char.HumanoidRootPart)
Slide.RelativeTo = "World"
Slide.Attachment0 = A0
Slide.Force = Char.HumanoidRootPart.CFrame.LookVector * Vector3.new(SlideForce, 0, SlideForce)

local T = Hum.Animator:LoadAnimation(SlideAnimation)
T:Play()

Slide.Parent = Char.HumanoidRootPart
Slide.Enabled = true

local tweenInfo = TweenInfo.new(0.0001, Enum.EasingStyle.Exponential, Enum.EasingDirection.InOut)
local targetForce = Char.HumanoidRootPart.CFrame.LookVector * Vector3.new(SlideForce, 0, SlideForce)
local tween = game:GetService('TweenService'):Create(Slide, tweenInfo, { Force = targetForce })
tween:Play()
1 Like

I’m sorry. I think I wrote it wrong.
I’m trying to convert this iteration to tweeen

I’m sorry. I think I wrote it wrong.
I’m trying to convert this iteration to tween