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

How to send a firework in the air? [closed]

Asked by 7 years ago

Hello,

I was wondering if someone could show me how to send a firework in the air using Cframe.

Thanks,

Anthony

Closed as Not Constructive by TheeDeathCaster and Pyrondon

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 7 years ago

Here is a script I made, that will send a rocket up at a decent speed with and explosion, and firework noise. Keep in mind I used a button(ClickDetector) so you may have to change the way the script is executed, if you want to make it fire when a player simply touches it.

local button = script.Parent
local Firework = script.Parent.Parent.Part


function makesound()
    local sound = Instance.new("Sound") -- makes the sound a thing
sound.SoundId = "http://www.roblox.com/asset/?id=138080762"  -- the firework sound it makes
sound.Parent = game.Workspace -- makes the sound a part of the rocket 
sound:Play() -- plays the noise as implied
end

function mexplosion() -- function that creates explosion
    local cracker = Instance.new("Explosion") -- actually makes the explosion existent
    cracker.Parent = workspace -- makes the explosion'tangible'
    cracker.Position = Firework.Position -- makes the explosion happen at the exact location of the rocket 
    cracker.BlastRadius = 8 -- size of blast radius
    cracker.BlastPressure = 5e+005  -- power of blast
end

function onClicked() --im using a button for this
    wait(1)
    for i = 1,130 do --how far up you want it to go
    Firework.Position = Firework.Position + Vector3.new (0,1,0) -- takes its current position and adds plus 1 on the y axis to it as fast as possible until it reaches the hight limit
    wait()
    end
    mexplosion() -- makes it explode
    makesound() --Makes the firework noise
    Firework:Destroy() -- makes it appear the explosion destroyed the rocket
end

script.Parent.ClickDetector.MouseClick:connect(onClicked) -- connecting the button
0
btw I'd add smoke particles to the script to, to add to the effect! macabe55101 38 — 7y
Ad