Hello,
I was wondering if someone could show me how to send a firework in the air using Cframe.
Thanks,
Anthony
Hello,
I was wondering if someone could show me how to send a firework in the air using Cframe.
Thanks,
Anthony
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
btw I'd add smoke particles to the script to, to add to the effect!
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
http://wiki.roblox.com/index.php?title=CFrame