Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Particle disable and re-enable?

Asked by 4 years ago
Edited 4 years ago

So basically i have a projectile script that goes like this:

script.Parent.OnServerEvent:Connect(function(plr)
    local Slash = game.ReplicatedStorage.Slash13.YSlash3:Clone()
    Slash.Parent = workspace
    Slash.CanCollide = false
    Slash.Anchored = false
    Slash.CFrame = plr.Character.HumanoidRootPart.CFrame * CFrame.new(0,0,-5) * CFrame.fromEulerAnglesXYZ(1.8,0,0)
    Slash.Touched:Connect(function(hit)
        if hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Name ~= plr.Name then
            local Explosion = game.ReplicatedStorage.Slash13.Booom3:Clone()
            Explosion.Parent = workspace
            Explosion.CFrame = Slash.CFrame
            Explosion.CanCollide = false
            Explosion.Anchored = true
            Slash:Destroy()
            script.Parent.Parent.Parent.Parent.Explosion2:Play()
            hit.Parent.Humanoid:TakeDamage(1000)
            for i = 1,32 do
                wait(.05)
                Explosion.Size = Explosion.Size + Vector3.new(2,2,2)        -- This bit needs to be changed to particle enable and disable
                Explosion.Transparency = Explosion.Transparency + 0.05
            end 
            Explosion:Destroy() 
        end
    end)    --This bit can be ignored
    local BV = Instance.new("BodyVelocity",Slash)
    BV.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
    BV.Velocity = plr.Character.HumanoidRootPart.CFrame.LookVector * 100
    wait(1.5)
    Slash:Destroy()
end)

i need the bit in green to change to a particle-like explosion!

ive tried:

Explosion:WaitForChild("Attatchment"):WaitForChild:("StarSplash").Enabled = true
wait(1)
Explosion:WaitForChild("Attatchment"):WaitForChild:("StarSplash").Enabled = false
wait(2)
Explosion:Destroy()

ive also tried without the "WaitForChild" bit

basically i want more of a seamless explosion instead of a attachment leaking out particles then getting deleted

1 answer

Log in to vote
0
Answered by 4 years ago

Replace This:

                for i = 1,32 do
                    wait(.05)
                    Explosion.Size = Explosion.Size + Vector3.new(2,2,2)        
                    Explosion.Transparency = Explosion.Transparency + 0.05
                end
                Explosion:Destroy()

with this

            Explosion:WaitForChild("StarSplash").Enabled = true
            Explosion:WaitForChild("Stars").Enabled = true
            wait(.5)
            Explosion:WaitForChild("StarSplash").Enabled = false
            Explosion:WaitForChild("Stars").Enabled = false
            wait(2)
            Explosion:Destroy() 

I've managed to fix the glitch, all i had to do is get the Booom3 part from replicated storage, delete the attatchment, make Booom3 the smallest [0.05,0.05,0.05] and put the particles in the booom3 insted of the attatchment

yes, i know i answered my own question, but i fixed it C:

Ad

Answer this question