So, I wanted to make tweening the character's LowerTorso 30 studs forward. It shall tween when a LocalScript fires an event which is child of the script called ForceA
. But it keeps saying an error message "Unable to cast Dictionary" in the output. The script for tweening is in the StarterCharacterScripts.
The TweenInfo I have used is:
local tweeninfo = TweenInfo.new( 5,Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0)
When a LocalScript fires the ForceA
event under the script, the character is supposed to tween 30 studs forward. The LowerTorso has joints that can move the full character. Instead it shows the error message.
It says the error is caused on line 5 of the function code below:
local lowertorso = Script.Parent.LowerTorso script.ForceA.OnServerEvent:Connect(function() local movingpos = lowertorso.CFrame * CFrame.new(0, 0, -30) local tween = TweenService:Create(lowertorso, tweeninfo, movingpos) tween:Play() end
I have used LookVector()
property and I am pretty sure it's a CFrame
position. Please help me out for this. I need this so much.
Create() has three params, the instance you want to tween, tweeninfo, and the properties you want to change in a dict, with as key the name of the prop and as value the value. atm you are just passing the value not a dict
so do this instead
local lowertorso = Script.Parent.LowerTorso script.ForceA.OnServerEvent:Connect(function() local movingpos = lowertorso.CFrame * CFrame.new(0, 0, -30) local tween = TweenService:Create(lowertorso, tweeninfo, {CFrame = movingpos}) tween:Play() end