How do I fix my tween script?
I keep getting an error message saying: “Unable to cast to Dictionary”
local TweenService = game:GetService("TweenService")
local BodyPosition = Instance.new("BodyPosition")
local WaitTime = script.Parent.WaitTime.Value
local Speed = script.Parent.Speed.Value
local Bruh = script.Parent.Bruh
Bruh.Position = Vector3.new(-7.5, 0.5, -35)
Bruh.Anchored = true
Bruh.Parent = game.Workspace
local tweenInfo = TweenInfo.new(
Speed,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
math.huge,
true,
WaitTime
)
local tween = TweenService:Create(tweenInfo, Bruh, BodyPosition, {Position = Vector3.new(-35.5, 0.5, -35)})
tween:Play()
You are creating your tween wrong. TweenService accepts arguments in a different way.
Correct syntax: TweenService:Create(instance, tweenInfo, propertyTable)
So you should change your TweenService:Create line to…
local tween = TweenService:Create(Bruh, tweenInfo, {Position = Vector3.new(-35.5, 0.5, -35)})
3 Likes
EmmieShayz:
local tween = TweenService:Create(Bruh, tweenInfo, {Position = Vector3.new(-35.5, 0.5, -35)})
I want the player to move with the platform, that’s the reason why I added the BodyPosition instance. The platform doesn’t move if you replace the Part with the instance.
Could you please explain what you’re doing in a little bit more detail? You might need a different approach.
1 Like
I just want to make the player move with a platform, that’s it.
Can’t you just make two tweens?
local charTween = TweenService:Create(Bruh, tweenInfo, {Position = Vector3.new(-35.5, 0.5, -35)})
local platformTween = TweenService:Create(BodyPosition, tweenInfo, {Position = Vector3.new(-35.5, 0.5, -35)})
charTween:Play()
platformTween:Play()
Edit: Definitely change the goal for one of those tweens since they would tween to the same spot.
1 Like
I’m pretty sure the Bruh variable is the platform part, and bodyPosition is the bodyPosition.
1 Like