How would I go about tweening multiple parts in one script? I keep getting an error

I am trying to tween multiple parts at once but I keep getting the error “Unable to cast to dictionary”.
Does anyone know how to solve this tedious problem?
I am in no way a scripter but am learning so I can make solo projects if I want to.
Any help would be appreciated.
Heres my tween script that gives me the error:

local tweenService = game:GetService(“TweenService”)

local tweenInformation = TweenInfo.new(
0.5,
Enum.EasingStyle.Quad,
Enum.EasingDirection.InOut,
0,
true,
0
)

local partInfo = {
Size = Vector3.new(Wave1, Wave2, Wave3.Size.X250,Wave1, Wave2, Wave3.Size.Y250,Wave1, Wave2, Wave3.Size.Z*250)
}

local tween = tweenService:Create(Wave1, Wave2, Wave3, tweenInformation, partInfo)

tween:Play()
end)
(Wave1, Wave2, and Wave3 are all variables that instance a new part)

3 Likes

You’re getting this error because TweenService:Create takes three arguments, the third of which should be a dictionary. Since the third argument is Wave3, a part, the error is saying it can’t make a part function as the dictionary it needs.

2 Likes

So is it even possible? If your saying I need 3 arguments and I have 5, I am kinda stuck.

1 Like

No, you can not tween 3 parts’ size to 3 different sizes whitin 1 tween.
Also I noticed that

Vector3 only has 3 axes, x, y and z while you tried to have 9 from what I can see right here.

2 Likes

You can instead try my tween function:

function Tween(Object, Time, Style, Direction, Repeat, Customization)
	game:GetService("TweenService"):Create(Object, TweenInfo.new(Time, Enum.EasingStyle[Style], Enum.EasingDirection[Direction], 0, Repeat, 0), Customization):Play()
end

How you would use it:

Tween(Wave1, .5, "Quad", "InOut", true, {Size = -- put the size here)
Tween(Wave2, .5, "Quad", "InOut", true, {Size = -- put the size here)
Tween(Wave3, .5, "Quad", "InOut", true, {Size = -- put the size here)
7 Likes

I am sorry for being such a newbie scripter, but I still don’t understand how I put that together.

1 Like

Okay, I can help you if you tell me what you want me to do

1 Like

Where do I put this:
Tween(Wave1, .5, “Quad”, “InOut”, true, {Size = *250)
Tween(Wave2, .5, “Quad”, “InOut”, true, {Size = *250)
Tween(Wave3, .5, “Quad”, “InOut”, true, {Size = *250)
Can you put it where it’s supposed to go?

1 Like

Heres my full script. Can you post my full script but with the tween?

local player = game.Players.LocalPlayer
game:GetService(“ReplicatedStorage”).TimeStop.OnServerEvent:connect(function(plr)
game.Workspace.TSSound:Play()
wait(3.2)
local Wave1 = Instance.new(“Part”)
Wave1.Name = “TimeWave1”
Wave1.Parent = game.Workspace
Wave1.Shape = Enum.PartType.Ball
Wave1.Anchored = true
Wave1.CanCollide = false
Wave1.Material = Enum.Material.ForceField
Wave1.Transparency = 0.4
Wave1.BrickColor = BrickColor.new(“Lime green”)
Wave1.Size = Vector3.new(0.7, 0.7, 0.7)
local Wave2 = Instance.new(“Part”)
Wave2.Name = “TimeWave2”
Wave2.Parent = game.Workspace
Wave2.Shape = Enum.PartType.Ball
Wave2.Anchored = true
Wave2.CanCollide = false
Wave2.Material = Enum.Material.ForceField
Wave2.Transparency = 0.4
Wave2.BrickColor = BrickColor.new(“New Yeller”)
Wave2.Size = Vector3.new(0.9, 0.9, 0.9)
local Wave3 = Instance.new(“Part”)
Wave3.Name = “TimeWave3”
Wave3.Parent = game.Workspace
Wave3.Shape = Enum.PartType.Ball
Wave3.Anchored = true
Wave3.CanCollide = false
Wave3.Material = Enum.Material.ForceField
Wave3.Transparency = 0.4
Wave3.BrickColor = BrickColor.new(“Magenta”)
Wave3.Size = Vector3.new(1.1, 1.1, 1.1)
Wave1.Position = plr.Character.HumanoidRootPart.Position
Wave2.Position = plr.Character.HumanoidRootPart.Position
Wave3.Position = plr.Character.HumanoidRootPart.Position
end)

1 Like

First of all,

Isn’t right. There should only be 3 arguments (Things in the parenthesis.) The first argument is the instance you want the tween to act on, the second argument is the tweeninfo you want the tween to use. The third argument is a table containing the new properties it should change to.
I think this might work.

local tween1 = tweenService:Create( wave1, tweenInformation, partInfo)
local tween2 = tweenService:Create( wave2, tweenInformation, partInfo)
local tween3 = tweenService:Create( wave3, tweenInformation, partInfo)
tween1:Play()
tween2:Play()
tween3:Play()

Also,

Makes no sense either.Vector3 should have 3 arguments, the X size, the Y size, and the Z size. You gave it like 9 arguments.

2 Likes

Alright so I have this but how can I make it so the Size from partInfo multiplies by 250?
local tweenService = game:GetService(“TweenService”)

local tweenInformation = TweenInfo.new(
.5,
Enum.EasingStyle.Quad,
Enum.EasingDirection.InOut,
0,
true,
0
)

local partInfo = {
Size = *250
}

local tween1 = tweenService:Create(Wave1, tweenInformation, partInfo)
local tween2 = tweenService:Create(Wave2, tweenInformation, partInfo)
local tween3 = tweenService:Create(Wave2, tweenInformation, partInfo)
tween1:Play()
tween2:Play()
tween3:Play()
end)

2 Likes

What I would do is this:

local partInfo1 = { 
Size = Wave1.Size * Vector3.new(250,250,250)
}

local partInfo2 = { 
Size = Wave2.Size * Vector3.new(250,250,250)
}

local partInfo3 = { 
Size = Wave3.Size * Vector3.new(250,250,250)
}

local tween1 = tweenService:Create(Wave1, tweenInformation, partInfo1)
local tween2 = tweenService:Create(Wave2, tweenInformation, partInfo2)
local tween3 = tweenService:Create(Wave2, tweenInformation, partInfo3)
tween1:Play()
tween2:Play()
tween3:Play()

Sorry if this is a little complicated lol

11 Likes

Yeah, I’m a starter scripter. I prefer to build but I wanna be able to make my own games if I want to.

2 Likes

Thank you so much! It worked perfect.

2 Likes

Np :smile:
(30 Charrrrrrrrrrrs)

1 Like

Just pass in multiple arguments such as:
local a =tween:Create(script.Parent.as, TweenInfo.new(1), {Position = Vector3.new(20.69, 177.39, -22.1), Orientation = Vector3.new(0, 90, 90)})