SHOW:
|
|
- or go back to the newest paste.
1 | - | local plr = game.Players.GINGIEHD |
1 | + | local plr = game.Players.SomeGuyVintage |
2 | local char = plr.Character | |
3 | local mouse = plr:GetMouse() | |
4 | local torso = char.Torso | |
5 | local head = char.Head | |
6 | local ra = char["Right Arm"] | |
7 | local la = char["Left Arm"] | |
8 | local rl = char["Right Leg"] | |
9 | local ll = char["Left Leg"] | |
10 | local human = char["Humanoid"] | |
11 | local camera = workspace.CurrentCamera | |
12 | local rs = torso:findFirstChild("Right Shoulder") | |
13 | local ls = torso:findFirstChild("Left Shoulder") | |
14 | local neck = torso:findFirstChild("Neck") | |
15 | local NO_moar_shooting = false | |
16 | local RunService = game:service'RunService' | |
17 | local ammo = 1 | |
18 | local spred = 2 | |
19 | ||
20 | ||
21 | ||
22 | function trail(obj) -- wroten by kert109 | |
23 | local lastPos = obj.CFrame.p | |
24 | coroutine.wrap(function() | |
25 | while obj ~= nil do | |
26 | RunService.Stepped:wait() | |
27 | local objC = obj:Clone() | |
28 | pcall(function() | |
29 | objC.Mesh:Destroy() | |
30 | end) | |
31 | objC.BrickColor = BrickColor.White() | |
32 | Instance.new("BlockMesh", objC).Scale = Vector3.new(0.2, 0.2, 1) | |
33 | objC.Parent = obj.Parent -- EPIC FAILURE> xD LOL | |
34 | objC.Anchored = true | |
35 | local distance = (lastPos- obj.CFrame.p).magnitude | |
36 | objC.Size = Vector3.new(.4,.4,distance) | |
37 | objC.CFrame = CFrame.new(lastPos,obj.Position)*CFrame.new(0,0,-distance/2) | |
38 | coroutine.wrap(function() | |
39 | for i = 0,1,.2 do | |
40 | wait() | |
41 | objC.Transparency = i | |
42 | end | |
43 | objC:Destroy() -- Easiest way without tables. :D | |
44 | end)() | |
45 | lastPos = obj.CFrame.p | |
46 | end | |
47 | end)() -- This | |
48 | end | |
49 | ||
50 | ||
51 | local sound = Instance.new("Sound", head) | |
52 | sound.SoundId = "http://www.roblox.com/asset/?id=16211041" | |
53 | sound.Volume = 1 | |
54 | local reloads = Instance.new("Sound", head) | |
55 | reloads.SoundId = "http://roblox.com/asset/?id=10209636" | |
56 | reloads.Volume = 1 | |
57 | reloads.Pitch = 0.7 | |
58 | local activate = Instance.new("Sound", head) | |
59 | activate.SoundId = "http://roblox.com/asset/?id=10209881" | |
60 | activate.Volume = 1 | |
61 | activate.Pitch = 0.7 | |
62 | ||
63 | ||
64 | local equipped = false | |
65 | ||
66 | local debounce = false | |
67 | ||
68 | local face = head.face | |
69 | ||
70 | ||
71 | release = Instance.new("Part", nil) | |
72 | release.FormFactor = "Custom" | |
73 | release.Size = Vector3.new(0.3, 1.7, 0.3) | |
74 | release.BrickColor = BrickColor.new("Brown") | |
75 | local weld = Instance.new("Weld", release) | |
76 | weld.Part0 = release | |
77 | weld.Part1 = head | |
78 | weld.C0 = CFrame.new(0, -0.5, -0.2) * CFrame.Angles(math.pi/2, 0, 0) | |
79 | local mesh = Instance.new("CylinderMesh", release) | |
80 | ||
81 | release2 = Instance.new("Part", nil) | |
82 | release2.FormFactor = "Custom" | |
83 | release2.Size = Vector3.new(0.2, 1.4, 0.2) | |
84 | release2.BrickColor = BrickColor.new("Brown") | |
85 | local weld2 = Instance.new("Weld", release2) | |
86 | weld2.Part0 = release2 | |
87 | weld2.Part1 = head | |
88 | weld2.C0 = CFrame.new(0.5, 0, -0.2) * CFrame.Angles(math.pi/2, math.pi/2, 0) | |
89 | local mesh2 = Instance.new("CylinderMesh", release2) | |
90 | ||
91 | headext = Instance.new("Part", nil) | |
92 | headext.Position = torso.Position | |
93 | headext.FormFactor = "Custom" | |
94 | headext.Transparency = 1 | |
95 | headext:BreakJoints() | |
96 | headext.Size = Vector3.new(2, 1, 1) | |
97 | headextw = Instance.new("Weld", headext) | |
98 | headextw.C0 = CFrame.new(Vector3.new(0, 1.5, 0)) | |
99 | headextw.Part0 = torso | |
100 | headextw.Part1 = headext | |
101 | headextw.C1 = CFrame.new() | |
102 | headweld = Instance.new("Weld", headext) | |
103 | game:service("RunService").Stepped:connect(function() | |
104 | headweld.C0 = CFrame.new(Vector3.new(0,0,0), torso.CFrame:pointToObjectSpace(mouse.Hit.p)) * CFrame.Angles(0, 0, 0) | |
105 | end) | |
106 | headweld.Part0 = headext | |
107 | headweld.C1 = CFrame.new() | |
108 | headweld.Part1 = head | |
109 | ||
110 | local Screen = Instance.new("ScreenGui", plr:findFirstChild("PlayerGui")) | |
111 | local TextBox = Instance.new("TextLabel", Screen) | |
112 | TextBox.Position = UDim2.new(0.1, 0, 0.95, 0) | |
113 | TextBox.Size = UDim2.new(0, 200, 0.05, 0) | |
114 | TextBox.BackgroundTransparency = 1 | |
115 | game:service'RunService'.Stepped:connect(function() | |
116 | TextBox.Text = ("Ammo: "..ammo) | |
117 | end) | |
118 | TextBox.Font = "SourceSansBold" | |
119 | TextBox.TextColor3 = Color3.new(1, 1, 1) | |
120 | TextBox.FontSize = "Size36" | |
121 | TextBox.TextStrokeTransparency = 0 | |
122 | ||
123 | local pl = Instance.new("PointLight", release) | |
124 | pl.Range = 16 | |
125 | pl.Brightness = 5 | |
126 | pl.Color = Color3.new(1, 199/255, 67/255) | |
127 | pl.Enabled = false | |
128 | function reload() | |
129 | wait(0.2) | |
130 | reloads:play() | |
131 | wait(0.5) | |
132 | ammo = 1 | |
133 | wait(1.5) | |
134 | activate:play() | |
135 | wait(0.5) | |
136 | debounce = false | |
137 | end | |
138 | ||
139 | mouse.KeyDown:connect(function(key) | |
140 | if key == "r" then | |
141 | if debounce then return end | |
142 | if not equipped then return end | |
143 | if ammo > 0 then return end | |
144 | debounce = true | |
145 | reload() | |
146 | end | |
147 | ||
148 | if key == "q" then | |
149 | equipped = not equipped | |
150 | if equipped then | |
151 | headext.Parent = char | |
152 | release.Parent = char | |
153 | release2.Parent = char | |
154 | face.Parent = nil | |
155 | for scale = 0, 1, 0.2 do | |
156 | weld2.C0 = CFrame.new(scale, 0, -0.2) * CFrame.Angles(math.pi/2, math.pi/2, 0) | |
157 | weld.C0 = CFrame.new(0, -scale + 0.5, -0.2) * CFrame.Angles(math.pi/2, 0, 0) | |
158 | mesh.Scale = Vector3.new(1, scale, 1) | |
159 | mesh2.Scale = Vector3.new(1, scale, 1) | |
160 | wait() | |
161 | end | |
162 | else | |
163 | face.Parent = head | |
164 | release.Parent = nil | |
165 | release2.Parent = nil | |
166 | headext.Parent = nil | |
167 | end | |
168 | end | |
169 | end) | |
170 | ||
171 | mouse.Button1Down:connect(function() | |
172 | if not equipped then return end | |
173 | if ammo < 1 then return end | |
174 | if debounce then return end | |
175 | debounce = true | |
176 | sound:play() | |
177 | ammo = ammo - 1 | |
178 | coroutine.wrap(function() | |
179 | for scale = 0.7, 1, 0.1 do | |
180 | mesh.Scale = Vector3.new(1, scale, 1) | |
181 | wait() | |
182 | end | |
183 | end)() | |
184 | ||
185 | coroutine.wrap(function() | |
186 | if char.Humanoid.Health < 1 then return end | |
187 | local rayPart = Instance.new("Part", char) | |
188 | rayPart.Name = "RayPart" | |
189 | rayPart.BrickColor = BrickColor.Yellow() | |
190 | rayPart.Anchored = true | |
191 | rayPart.CanCollide = false | |
192 | rayPart.TopSurface = Enum.SurfaceType.Smooth | |
193 | rayPart.BottomSurface = Enum.SurfaceType.Smooth | |
194 | rayPart.formFactor = Enum.FormFactor.Custom | |
195 | rayPart.Size = Vector3.new(0.2, 0.2, 4) | |
196 | local mesh = Instance.new("SpecialMesh", rayPart) | |
197 | mesh.MeshType = "FileMesh" | |
198 | mesh.MeshId = "http://www.roblox.com/asset/?id=15887356" | |
199 | mesh.TextureId = "http://www.roblox.com/asset/?id=15886781" | |
200 | mesh.Scale = Vector3.new(-1, 1, -1.5) | |
201 | ||
202 | ||
203 | ||
204 | ||
205 | local bulletposition = release.Position | |
206 | local bulletvelocity = (Vector3.new(math.random(-spred,spred), math.random(-spred,spred), math.random(-spred,spred)))+( mouse.Hit.p - bulletposition).unit*150 | |
207 | local bulletlastposition = bulletposition | |
208 | rayPart.CFrame = CFrame.new( bulletposition, bulletposition+bulletvelocity ) | |
209 | local connection = trail(rayPart) | |
210 | ||
211 | ||
212 | ||
213 | ||
214 | ||
215 | coroutine.resume(coroutine.create(function() | |
216 | while true do | |
217 | local dt = wait() | |
218 | bulletlastposition = bulletposition | |
219 | bulletvelocity = bulletvelocity + (Vector3.new(0, -9.81*10, 0)*dt) | |
220 | bulletposition = bulletposition + (bulletvelocity*dt) | |
221 | ||
222 | local ray = Ray.new(bulletlastposition, (bulletposition - bulletlastposition)) | |
223 | local hit, hitposition = workspace:FindPartOnRayWithIgnoreList( ray, { char, rayPart} ) | |
224 | ||
225 | if (torso.Position - rayPart.Position).magnitude > 440 then | |
226 | rayPart:Destroy() | |
227 | break | |
228 | end | |
229 | ||
230 | ||
231 | if hit then | |
232 | local damage = math.random(40, 75) | |
233 | if hit.Parent:findFirstChild("Humanoid") ~= nil then | |
234 | hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - damage | |
235 | coroutine.wrap(function() | |
236 | local prt = Instance.new("Part", char) | |
237 | prt.FormFactor = "Custom" | |
238 | prt.Size = Vector3.new(0.1, 0.1, 0.1) | |
239 | prt.Transparency = 1 | |
240 | prt.CanCollide = false | |
241 | prt.CFrame = CFrame.new(rayPart.CFrame.x, rayPart.CFrame.y, rayPart.CFrame.z) | |
242 | prt.Anchored = true | |
243 | coroutine.resume(coroutine.create(function() | |
244 | for i = 2, 10, 0.1 do | |
245 | if prt == nil then return end | |
246 | prt.CFrame = prt.CFrame * CFrame.new(0, 0.05, 0) | |
247 | game:service'RunService'.Stepped:wait() | |
248 | end | |
249 | end)) | |
250 | ||
251 | local bg = Instance.new("BillboardGui") | |
252 | bg.Parent = prt | |
253 | bg.Adornee = prt | |
254 | bg.Size = UDim2.new(4, 0, 3.5, 0) | |
255 | bg.ExtentsOffset = Vector3.new(0, 0, 0) | |
256 | local lol = Instance.new("TextLabel") | |
257 | lol.Size = UDim2.new(1.3, 0, 0.4, 0) | |
258 | lol.TextScaled = true | |
259 | lol.TextWrapped = true | |
260 | lol.BackgroundTransparency = 1 | |
261 | lol.Parent = bg | |
262 | lol.FontSize = "Size24" | |
263 | lol.TextColor3 = Color3.new(1, 0, 0) | |
264 | lol.TextStrokeTransparency = 0 | |
265 | lol.Font = "ArialBold" | |
266 | lol.Text = "-"..damage | |
267 | ||
268 | wait(3) | |
269 | prt:Destroy() | |
270 | end)() | |
271 | end | |
272 | if hit.Parent:IsA("Hat") and hit.Parent.Parent:findFirstChild("Humanoid") ~= nil then | |
273 | hit.Parent.Parent.Humanoid.Health = hit.Parent.Parent.Humanoid.Health - damage | |
274 | coroutine.wrap(function() | |
275 | local prt = Instance.new("Part", char) | |
276 | prt.FormFactor = "Custom" | |
277 | prt.Size = Vector3.new(0.1, 0.1, 0.1) | |
278 | prt.Transparency = 1 | |
279 | prt.CanCollide = false | |
280 | prt.CFrame = CFrame.new(rayPart.CFrame.x, rayPart.CFrame.y, rayPart.CFrame.z) | |
281 | prt.Anchored = true | |
282 | coroutine.resume(coroutine.create(function() | |
283 | for i = 2, 10, 0.05 do | |
284 | if prt == nil then return end | |
285 | prt.CFrame = prt.CFrame * CFrame.new(0, 0.05, 0) | |
286 | game:service'RunService'.Stepped:wait() | |
287 | end | |
288 | end)) | |
289 | ||
290 | local bg = Instance.new("BillboardGui") | |
291 | bg.Parent = prt | |
292 | bg.Adornee = prt | |
293 | bg.Size = UDim2.new(4, 0, 3.5, 0) | |
294 | bg.ExtentsOffset = Vector3.new(0, 0, 0) | |
295 | local lol = Instance.new("TextLabel") | |
296 | lol.Size = UDim2.new(1.3, 0, 0.4, 0) | |
297 | lol.TextScaled = true | |
298 | lol.TextWrapped = true | |
299 | lol.BackgroundTransparency = 1 | |
300 | lol.Parent = bg | |
301 | lol.FontSize = "Size24" | |
302 | lol.TextColor3 = Color3.new(1, 0, 0) | |
303 | lol.TextStrokeTransparency = 0 | |
304 | lol.Font = "ArialBold" | |
305 | slol.Text = "-"..damage | |
306 | ||
307 | wait(3) | |
308 | prt:Destroy() | |
309 | vsend)() | |
310 | end | |
311 | bulletposition = hitposition | |
312 | rayPart.CFrame = CFrame.new(bulletposition, bulletposition+bulletvelocity) | |
313 | wait(0.5) | |
314 | rayPart:Destroy() | |
315 | connection:disconnect() | |
316 | break | |
317 | end | |
318 | rayPart.CFrame = CFrame.new(bulletposition, bulletposition+bulletvelocity) | |
319 | end | |
320 | end)) | |
321 | end)() | |
322 | wait(0.8) | |
323 | debounce = false | |
324 | ||
325 | end) |