Im trying to make something where it tweens all the model at oncem, but it goes 1 by 1.
</Other Info</>
-Line of error - No error.
-Model Name - Gaster Blaster
-Script Location - game.Workspace.Gaster Blaster.Script
</>Code</>
for i,v in pairs(script.Parent:GetChildren()) do
if v:IsA("BasePart")or v:IsA('UnionOperation') then
local tweenService = game:GetService("TweenService");
local tweenInfo = TweenInfo.new(
game:GetService("Players").RespawnTime - 0,
Enum.EasingStyle.Quad,
Enum.EasingDirection.Out
)
local goal = {
Transparency = 0;
}
local finalTween = tweenService:Create(v, tweenInfo, goal)
finalTween:Play()
for i,v in pairs(script.Parent:GetChildren()) do
if v:IsA("BasePart")or v:IsA('UnionOperation') then
local tweenService = game:GetService("TweenService");
local tweenInfo = TweenInfo.new(
game:GetService("Players").RespawnTime - 0,
Enum.EasingStyle.Quad,
Enum.EasingDirection.Out
)
local goal = {
Transparency = 0;
}
local finalTween = tweenService:Create(v, tweenInfo, goal)
spawn(function() finalTween:Play() end)
end
end
They shouldn’t be playing separately in general. I copied your script and I’ve had no problem with them playing one at a time. May I see the full script?
I added some minor things to make the tween more apparent, but it shouldn’t change anything.
Code I used:
local ModelChildren = workspace.Test:GetChildren()
for Index, Current in pairs(ModelChildren) do
if (Current:IsA("BasePart") or Current:IsA("UnionOperation")) then
local TweenService = game:GetService("TweenService")
local TWInfo = TweenInfo.new(
game:GetService("Players").RespawnTime + 20,
Enum.EasingStyle.Quad
--- Default easing direction is out so no need to put anything here
)
local Goal = {
Transparency = 1,
CFrame = Current.CFrame * CFrame.new(0, 10, 0)
}
local Tween = TweenService:Create(Current, TWInfo, Goal)
Tween:Play()
end
end
Heres an example of using coroutine.wrap, this is my script for animating rocket thrusters
local ts = game:GetService("TweenService")
local ta = TweenInfo.new(.8,Enum.EasingStyle.Linear)
while true do
for _, v in ipairs(script.Parent:GetChildren()) do
if v:IsA("MeshPart") then
local co = coroutine.wrap(function()
local t = ts:Create(v,ta,{Transparency = 1})
t:Play()
t.Completed:Wait()
local t2 = ts:Create(v,ta,{Transparency = 0})
t2:Play()
t2.Completed:Wait()
end)
co()
end
end
end
to be honest my bad for the first reply as its completely wrong by guessing but here’s your fix so the coroutine must start when you for loop iterating through the parts in your Gaster Blaster
for i,v in pairs(script.Parent:GetChildren()) do
if v:IsA("BasePart")or v:IsA('UnionOperation') then
local co = coroutine.wrap(function()
local tweenService = game:GetService("TweenService");
local tweenInfo = TweenInfo.new(
game:GetService("Players").RespawnTime - 0,
Enum.EasingStyle.Quad,
Enum.EasingDirection.Out
)
local goal = {
Transparency = 0;
}
local finalTween = tweenService:Create(v, tweenInfo, goal)
finalTween:Play()
end)
co()