SHOW:
|
|
- or go back to the newest paste.
1 | local baseHitbox = Instance.new("Part") | |
2 | baseHitbox.Size = Vector3.new(2,2,2) | |
3 | baseHitbox.BrickColor = BrickColor.new("Mid gray") | |
4 | baseHitbox.Shape = Enum.PartType.Ball | |
5 | baseHitbox.CanCollide = false | |
6 | baseHitbox.Transparency = 1 | |
7 | baseHitbox.Name = "CO2" | |
8 | ||
9 | ||
10 | local hitboxVelocity = Instance.new("BodyVelocity") | |
11 | hitboxVelocity.P = 1000 | |
12 | hitboxVelocity.Velocity = Vector3.new() | |
13 | hitboxVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge) | |
14 | hitboxVelocity.Name = "BodyVelocity" | |
15 | hitboxVelocity.Parent = baseHitbox | |
16 | ||
17 | ||
18 | runService.Heartbeat:Connect(function(t) | |
19 | if shooting then | |
20 | shootTimer += t | |
21 | ||
22 | ||
23 | if shootTimer > 0.5 then | |
24 | shootTimer -= 0.5 | |
25 | ||
26 | ||
27 | local offset = Vector3.new( | |
28 | (math.random() - 0.5) * 5, | |
29 | (math.random() - 0.5) * 5, | |
30 | (math.random() - 0.5) * 5 | |
31 | ) | |
32 | ||
33 | ||
34 | local newHitbox = baseHitbox:Clone() | |
35 | newHitbox.BodyVelocity.Velocity = tool.Handle.CFrame.RightVector * 20 + offset | |
36 | newHitbox.Position = handle.Nozzle.WorldPosition | |
37 | newHitbox.Parent = tool.Parent | |
38 | game:GetService("Debris"):AddItem(newHitbox, 2) | |
39 | ||
40 | ||
41 | if shootTimer > 0.5 then | |
42 | shootTimer = 0 | |
43 | end | |
44 | end | |
45 | ||
46 | ||
47 | if spraySound.TimePosition > 2.3 then | |
48 | spraySound.TimePosition = 0.5 | |
49 | end | |
50 | end | |
51 | end) | |
52 |