How to play Fade Effect and Particles at the same time

What do you want to achieve?
I want both Fade Effect and Particles to play at the same time, right now Fade Effect always starts the first and when it ends particles start playing… All i want is them both to play at the same time…

What solutions have you tried so far?
It might be a dumb question and an easy solution, but right now i’m clueless and i tried to find something useful in Devforum but didn’t find anything.

Code:

-- Services --
local RS = game:GetService('ReplicatedStorage')
local TS = game:GetService("TweenService")

-- Remotes --
local DeathRemote = RS.Remotes:WaitForChild('DiedRE')

-- Variables --
local fadeTI = TweenInfo.new(2, Enum.EasingStyle.Quint, Enum.EasingDirection.InOut)
local particlesTI = TweenInfo.new(2, Enum.EasingStyle.Quint, Enum.EasingDirection.InOut)


game.Players.PlayerAdded:Connect(function(plr)
	
	plr.CharacterAdded:Connect(function(char)
		
		
		local humanoid = char:WaitForChild("Humanoid")
		humanoid.BreakJointsOnDeath = false
	end)
end)

DeathRemote.OnServerEvent:Connect(function(plr)
	
	if not plr.Character or not plr.Character:FindFirstChild("Humanoid") then return end
	
	local char = plr.Character
	local humanoid = char.Humanoid
	
	char.HumanoidRootPart.Anchored = true

	for i, d in pairs(char:GetDescendants()) do		

		if d:IsA("BasePart") or d:IsA("Decal") then

			spawn(function()
				TS:Create(d, fadeTI, {Transparency = 1}):Play()

				local particles = script.Aura:Clone() and script.Fire:Clone() and script.Orbs:Clone()
				particles.Rate = 0

				TS:Create(particles, particlesTI, {Rate = 100}):Play()

				particles.Parent = d

				wait(3)
				TS:Create(particles, particlesTI, {Rate = 0}):Play()
			end)
		end
	end
	
	wait(5)
	
	plr:LoadCharacter()
end)

Soo… Someone that could help me with this?

just put the tweens in separate threads
coroutine.wrap(function() tween end)()

How should it look like into the script that i posted? Sorry, but i’m not used to coroutine.wrap that much still…

Either make the particle Tween play faster, or maybe set the rate to something like 10 before playing the tween, so that the particles are seen at the max earlier.

Essentially the reason why this is happening is because it takes 2 seconds for the particles to be at max capacity, then for a second after that (because of the wait(3), which you should change to task.wait(3)) the particles are at 100, only then do they start diminishing (this also takes 2 seconds for them to go away completely).

1 Like

Oh i see, this helped and i also changed wait() for task.wait()… Thanks!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.