Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local baseHitbox = Instance.new("Part")
- baseHitbox.Size = Vector3.new(2,2,2)
- baseHitbox.BrickColor = BrickColor.new("Mid gray")
- baseHitbox.Shape = Enum.PartType.Ball
- baseHitbox.CanCollide = false
- baseHitbox.Transparency = 1
- baseHitbox.Name = "CO2"
- local hitboxVelocity = Instance.new("BodyVelocity")
- hitboxVelocity.P = 1000
- hitboxVelocity.Velocity = Vector3.new()
- hitboxVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
- hitboxVelocity.Name = "BodyVelocity"
- hitboxVelocity.Parent = baseHitbox
- runService.Heartbeat:Connect(function(t)
- if shooting then
- shootTimer += t
- if shootTimer > 0.5 then
- shootTimer -= 0.5
- local offset = Vector3.new(
- (math.random() - 0.5) * 5,
- (math.random() - 0.5) * 5,
- (math.random() - 0.5) * 5
- )
- local newHitbox = baseHitbox:Clone()
- newHitbox.BodyVelocity.Velocity = tool.Handle.CFrame.RightVector * 20 + offset
- newHitbox.Position = handle.Nozzle.WorldPosition
- newHitbox.Parent = tool.Parent
- game:GetService("Debris"):AddItem(newHitbox, 2)
- if shootTimer > 0.5 then
- shootTimer = 0
- end
- end
- if spraySound.TimePosition > 2.3 then
- spraySound.TimePosition = 0.5
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement