Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local plr = owner
- local char = plr.Character
- local root = char.HumanoidRootPart
- local sprite = 137511594
- local tool = Instance.new("Tool")
- tool.Name = 'Firework Rocket'
- tool.ToolTip = 'Go out with a bang!'
- tool.TextureId = 'rbxassetid://' .. sprite
- tool.Parent = plr.Backpack
- local library = {
- twinkle_far = 8597162279,
- twinke = 8597161656,
- large_blast_far = 8597161008,
- large_blast = 8597160297,
- launch = 8597159557,
- }
- function play_sound(par,id,vol,speed,min,max)
- local s = Instance.new("Sound")
- s.SoundId = 'rbxassetid://' .. id
- s.Volume = vol or 0.5
- s.PlaybackSpeed = speed or 1
- s.RollOffMaxDistance = max
- s.RollOffMinDistance = min
- s.Parent = par or root
- s:Play()
- s.Ended:Connect(function()
- task.wait()
- s:Destroy()
- end)
- return s
- end
- pcall(function()
- game:GetService("PhysicsService"):CreateCollisionGroup('fireworks')
- game:GetService("PhysicsService"):CreateCollisionGroup('chars')
- game:GetService("PhysicsService"):CollisionGroupSetCollidable('fireworks','chars',false)
- game:GetService("PhysicsService"):CollisionGroupSetCollidable('fireworks','fireworks',false)
- end)
- for i,v in ipairs(char:GetDescendants()) do
- if v:IsA("BasePart") then
- game:GetService("PhysicsService"):SetPartCollisionGroup(v,'chars')
- end
- end
- function filter_char(c)
- if c ~= char then else return end
- for i,v in ipairs(c:GetDescendants()) do
- if v:IsA("BasePart") then
- game:GetService("PhysicsService"):SetPartCollisionGroup(v,'chars')
- end
- end
- end
- for i,v in ipairs(workspace:GetChildren()) do
- if v:IsA("Model") and v:FindFirstChildOfClass("Humanoid") then
- filter_char(v)
- end
- end
- workspace.ChildAdded:Connect(function(v)
- if v:IsA("Model") and v:FindFirstChildOfClass("Humanoid") then
- filter_char(v)
- end
- end)
- function fire(pos)
- local explosion = Instance.new("ParticleEmitter")
- explosion.LightEmission = 1
- explosion.LightInfluence = 0
- explosion.Orientation = Enum.ParticleOrientation.FacingCamera
- explosion.Texture = "rbxassetid://6995657416"
- explosion.Transparency = NumberSequence.new(0,1)
- explosion.Acceleration = Vector3.new(0,-5,0)
- explosion.Drag = 0
- explosion.EmissionDirection = Enum.NormalId.Top
- explosion.Enabled = false
- explosion.Lifetime = NumberRange.new(3, 3.1)
- explosion.Rotation = NumberRange.new(45, 45)
- explosion.RotSpeed = NumberRange.new(-500, 500)
- explosion.Speed = NumberRange.new(70, 80)
- explosion.Shape = Enum.ParticleEmitterShape.Sphere
- explosion.ShapeStyle = Enum.ParticleEmitterShapeStyle.Surface
- explosion.ShapeInOut = Enum.ParticleEmitterShapeInOut.Outward
- explosion.ShapePartial = 1
- explosion.Drag = 5
- local phy_part = Instance.new("Part")
- phy_part.Transparency = 1
- phy_part.Massless = true
- phy_part.CanCollide = true
- phy_part.Anchored = false
- phy_part.Size = Vector3.new(1,1,1)
- phy_part.CFrame = CFrame.new(pos)*CFrame.new(0,0.5,0)
- game:GetService("PhysicsService"):SetPartCollisionGroup(phy_part,'fireworks')
- local att = Instance.new("Attachment")
- att.Parent = phy_part
- local img = Instance.new("ParticleEmitter")
- img.LightEmission = 0
- img.LightInfluence = 0
- img.Orientation = Enum.ParticleOrientation.FacingCameraWorldUp
- img.Texture = "rbxassetid://" .. sprite
- img.Transparency = NumberSequence.new(0)
- img.Enabled = false
- img.LockedToPart = true
- img.Lifetime = NumberRange.new(1/0)
- img.Speed = NumberRange.new(0)
- img.SpreadAngle = Vector2.new(0,0)
- img.Parent = att
- local force = Instance.new("BodyForce")
- force.Parent = phy_part
- phy_part.Parent = script
- img:Emit()
- local reduce_dist = 16*4
- play_sound(phy_part,library.launch,0.5,1,reduce_dist,reduce_dist*2)
- coroutine.wrap(function()
- local st = os.clock()
- local dur = 2 + math.random()*0.5
- local y = phy_part:GetMass()
- local x = 0.001
- local z = 0.001
- if math.random(1,2) == 1 then
- x = -x
- end
- if math.random(1,2) == 1 then
- z = -z
- end
- repeat
- local y = (y + 0.05*(os.clock()-st)*4) * workspace.Gravity
- local x = (x*(os.clock()-st)*1.15*4) * workspace.Gravity
- local z = (z*(os.clock()-st)*1.15*4) * workspace.Gravity
- force.Force = Vector3.new(x,y,z)
- task.wait()
- until os.clock()-st >= dur
- phy_part.Anchored = true
- local s = 8
- --phy_part.Size = Vector3.new(s,s,s)
- att:Destroy()
- explosion.Parent = phy_part
- explosion:Emit(300)
- play_sound(phy_part,library.large_blast_far,2,1,reduce_dist,reduce_dist*3)
- task.wait(0.1)
- play_sound(phy_part,library.twinkle_far,2,1,reduce_dist,reduce_dist*3)
- end)()
- end
- local last = 0
- local fire_id = 0
- local mouse_pos = Vector3.new()
- local firing = false
- script.Parent = char
- local remote = Instance.new("RemoteEvent")
- remote.Parent = script
- function equipped()
- return tool:IsDescendantOf(char)
- end
- remote.OnServerEvent:Connect(function(lplr,id,data)
- if lplr == plr and equipped() then
- if id == 1 then
- if data and not firing then
- firing = true
- fire_id += 1
- local cid = fire_id
- local count = 0
- while fire_id == cid do
- local cooldown = (5-count)/10
- if os.clock()-last >= cooldown then
- count += 1
- count = math.clamp(count,0,4)
- last = os.clock()
- fire(mouse_pos)
- end
- task.wait()
- end
- else
- firing = false
- fire_id += 1
- end
- elseif id == 2 then
- mouse_pos = data
- end
- end
- end)
- NLS([[
- local plr = owner
- local mouse = plr:GetMouse()
- local remote = script.Parent
- mouse.TargetFilter = remote.Parent
- game:GetService("UserInputService").InputBegan:Connect(function(input,gamepress)
- if not gamepress then else return end
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- remote:FireServer(1,true)
- end
- end)
- game:GetService("UserInputService").InputEnded:Connect(function(input,gamepress)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- remote:FireServer(1,false)
- end
- end)
- while true do
- remote:FireServer(2,mouse.Hit.Position)
- task.wait(0.1)
- end
- ]],remote)
Add Comment
Please, Sign In to add comment