SHOW:
|
|
- or go back to the newest paste.
1 | --Converted with ttyyuu12345's model to script plugin v4 | |
2 | function sandbox(var,func) | |
3 | local env = getfenv(func) | |
4 | local newenv = setmetatable({},{ | |
5 | __index = function(self,k) | |
6 | if k=="script" then | |
7 | return var | |
8 | else | |
9 | return env[k] | |
10 | end | |
11 | end, | |
12 | }) | |
13 | setfenv(func,newenv) | |
14 | return func | |
15 | end | |
16 | cors = {} | |
17 | mas = Instance.new("Model",game:GetService("Lighting")) | |
18 | print("A hyper shotgun maded by pdnghiaqoi!") | |
19 | Tool0 = Instance.new("Tool") | |
20 | Part1 = Instance.new("Part") | |
21 | SpecialMesh2 = Instance.new("SpecialMesh") | |
22 | Sound3 = Instance.new("Sound") | |
23 | Sound4 = Instance.new("Sound") | |
24 | PointLight5 = Instance.new("PointLight") | |
25 | Weld6 = Instance.new("Weld") | |
26 | Weld7 = Instance.new("Weld") | |
27 | Weld8 = Instance.new("Weld") | |
28 | LocalScript9 = Instance.new("LocalScript") | |
29 | Sound10 = Instance.new("Sound") | |
30 | LocalScript11 = Instance.new("LocalScript") | |
31 | Part12 = Instance.new("Part") | |
32 | SpecialMesh13 = Instance.new("SpecialMesh") | |
33 | PointLight14 = Instance.new("PointLight") | |
34 | Script15 = Instance.new("Script") | |
35 | Script16 = Instance.new("Script") | |
36 | Tool0.Name = "LaserShotGun" | |
37 | Tool0.Parent = mas | |
38 | Tool0.TextureId = "http://www.roblox.com/asset?id=130093050" | |
39 | Tool0.GripForward = Vector3.new(-0.376944453, -0.000461966498, -0.926235735) | |
40 | Tool0.GripPos = Vector3.new(0, 0.200000003, 0.25000003) | |
41 | Tool0.GripRight = Vector3.new(0.926235914, -0.000188003658, -0.376944423) | |
42 | Tool0.GripUp = Vector3.new(1.45519152e-11, 0.999999881, -0.000498756883) | |
43 | Tool0.ToolTip = "A hyper shotgun made and edit by pdnghiaqoi" | |
44 | Tool0.CanBeDropped = false | |
45 | Part1.Name = "Handle" | |
46 | Part1.Parent = Tool0 | |
47 | Part1.Rotation = Vector3.new(-180, 0, -180) | |
48 | Part1.CanCollide = false | |
49 | Part1.FormFactor = Enum.FormFactor.Custom | |
50 | Part1.Size = Vector3.new(0.580000222, 1.34000099, 4.48000145) | |
51 | Part1.CFrame = CFrame.new(8.28999901, 0.670000017, 25.8400002, -0.999997616, 9.05775108e-12, -1.88592058e-08, -9.13322282e-12, 0.999997377, 6.28057464e-08, -1.53668083e-08, -6.28641601e-08, -0.999999821) | |
52 | Part1.BottomSurface = Enum.SurfaceType.Smooth | |
53 | Part1.TopSurface = Enum.SurfaceType.Smooth | |
54 | Part1.Position = Vector3.new(8.28999901, 0.670000017, 25.8400002) | |
55 | Part1.Orientation = Vector3.new(0, -180, 0) | |
56 | SpecialMesh2.Parent = Part1 | |
57 | SpecialMesh2.MeshId = "http://www.roblox.com/asset?id=130099641" | |
58 | SpecialMesh2.Scale = Vector3.new(1, 0.75, 1.5) | |
59 | SpecialMesh2.TextureId = "http://www.roblox.com/asset?id=130093033" | |
60 | SpecialMesh2.MeshType = Enum.MeshType.FileMesh | |
61 | SpecialMesh2.Scale = Vector3.new(1, 0.75, 1.5) | |
62 | Sound3.Name = "Fire" | |
63 | Sound3.Parent = Part1 | |
64 | Sound3.Pitch = 0.5 | |
65 | Sound3.SoundId = "http://www.roblox.com/asset?id=130113322" | |
66 | Sound3.Volume = 1 | |
67 | Sound4.Name = "Reload" | |
68 | Sound4.Parent = Part1 | |
69 | Sound4.Pitch = 0.5 | |
70 | Sound4.SoundId = "http://www.roblox.com/asset?id=130113370" | |
71 | PointLight5.Parent = Part1 | |
72 | PointLight5.Color = Color3.new(0, 1, 1) | |
73 | PointLight5.Range = 6 | |
74 | PointLight5.Color = Color3.new(0, 1, 1) | |
75 | Weld6.Parent = Part1 | |
76 | Weld6.C0 = CFrame.new(0, 0, 0, -3.17205462e-08, 2.98023188e-08, 0.999999821, 4.42590249e-08, 0.999999821, -2.98023295e-08, -1, 4.42590107e-08, -3.17205746e-08) | |
77 | Weld6.C1 = CFrame.new(0, 0, 0, -3.17205462e-08, 2.98023188e-08, 0.999999821, 4.42590249e-08, 0.999999821, -2.98023295e-08, -1, 4.42590107e-08, -3.17205746e-08) | |
78 | Weld6.Part0 = Part1 | |
79 | Weld6.Part1 = Part1 | |
80 | Weld7.Parent = Part1 | |
81 | Weld7.C0 = CFrame.new(0, 0, 0, -0.823671401, 0.00976598449, 0.566983223, 0.566961288, -0.00514982874, 0.823728263, 0.0109643862, 0.999939024, -0.00129515026) | |
82 | Weld7.C1 = CFrame.new(0, 0, 0, -0.823671401, 0.00976598449, 0.566983223, 0.566961288, -0.00514982874, 0.823728263, 0.0109643862, 0.999939024, -0.00129515026) | |
83 | Weld7.Part0 = Part1 | |
84 | Weld7.Part1 = Part1 | |
85 | Weld8.Parent = Part1 | |
86 | Weld8.C0 = CFrame.new(0, 0, 0, -0.823671401, 0.00976598449, 0.566983223, 0.566961288, -0.00514982874, 0.823728263, 0.0109643862, 0.999939024, -0.00129515026) | |
87 | Weld8.C1 = CFrame.new(-0.399999499, 0, 1.1920929e-07, -0.823670983, 0.00976601522, 0.566982925, 0.56696099, -0.00514967833, 0.823727846, 0.0109643312, 0.999939024, -0.00129529205) | |
88 | Weld8.Part0 = Part1 | |
89 | Weld8.Part1 = Part12 | |
90 | LocalScript9.Name = "ToolScript" | |
91 | LocalScript9.Parent = Tool0 | |
92 | table.insert(cors,sandbox(LocalScript9,function() | |
93 | ----------------- | |
94 | --| Constants |-- | |
95 | ----------------- | |
96 | ||
97 | local SHOT_SPEED =250 | |
98 | - | local SHOT_TIME = 3 |
98 | + | local SHOT_TIME = math.huge |
99 | ||
100 | local NOZZLE_OFFSET = Vector3.new(0, 0.4, -1.1) | |
101 | ||
102 | ----------------- | |
103 | --| Variables |-- | |
104 | ----------------- | |
105 | ||
106 | local PlayersService = Game:GetService('Players') | |
107 | local DebrisService = Game:GetService('Debris') | |
108 | ||
109 | local Tool = script.Parent | |
110 | local Handle = Tool:WaitForChild('Handle') | |
111 | ||
112 | local FireSound = Handle:WaitForChild('Fire') | |
113 | local ReloadSound = Handle:WaitForChild('Reload') | |
114 | local HitFadeSound = script:WaitForChild('HitFade') | |
115 | ||
116 | local PointLight = Handle:WaitForChild('PointLight') | |
117 | ||
118 | local Character = nil | |
119 | local Humanoid = nil | |
120 | local Player = nil | |
121 | ||
122 | local BaseShot = nil | |
123 | ||
124 | ----------------- | |
125 | --| Functions |-- | |
126 | ----------------- | |
127 | ||
128 | -- Returns a character ancestor and its Humanoid, or nil | |
129 | local function FindCharacterAncestor(subject) | |
130 | if subject and subject ~= Workspace then | |
131 | local humanoid = subject:FindFirstChild('Humanoid') | |
132 | if humanoid then | |
133 | return subject, humanoid | |
134 | else | |
135 | return FindCharacterAncestor(subject.Parent) | |
136 | end | |
137 | end | |
138 | return nil | |
139 | end | |
140 | ||
141 | -- Removes any old creator tags and applies new ones to the specified target | |
142 | local function ApplyTags(target) | |
143 | while target:FindFirstChild('creator') do | |
144 | target.creator:Destroy() | |
145 | end | |
146 | ||
147 | local creatorTag = Instance.new('ObjectValue') | |
148 | creatorTag.Value = Player | |
149 | creatorTag.Name = 'creator' --NOTE: Must be called 'creator' for website stats | |
150 | ||
151 | local iconTag = Instance.new('StringValue') | |
152 | iconTag.Value = Tool.TextureId | |
153 | iconTag.Name = 'icon' | |
154 | ||
155 | iconTag.Parent = creatorTag | |
156 | creatorTag.Parent = target | |
157 | DebrisService:AddItem(creatorTag, 4) | |
158 | end | |
159 | ||
160 | -- Returns all objects under instance with Transparency | |
161 | local function GetTransparentsRecursive(instance, partsTable) | |
162 | local partsTable = partsTable or {} | |
163 | for _, child in pairs(instance:GetChildren()) do | |
164 | if child:IsA('BasePart') or child:IsA('Decal') then | |
165 | table.insert(partsTable, child) | |
166 | end | |
167 | GetTransparentsRecursive(child, partsTable) | |
168 | end | |
169 | return partsTable | |
170 | end | |
171 | ||
172 | local function SelectionBoxify(instance) | |
173 | local selectionBox = Instance.new('SelectionBox') | |
174 | selectionBox.Adornee = instance | |
175 | selectionBox.Color = BrickColor.new('Toothpaste') | |
176 | selectionBox.Parent = instance | |
177 | return selectionBox | |
178 | end | |
179 | ||
180 | local function Light(instance) | |
181 | local light = PointLight:Clone() | |
182 | light.Range = light.Range + 2 | |
183 | light.Parent = instance | |
184 | end | |
185 | ||
186 | local function FadeOutObjects(objectsWithTransparency, fadeIncrement) | |
187 | repeat | |
188 | local lastObject = nil | |
189 | for _, object in pairs(objectsWithTransparency) do | |
190 | object.Transparency = object.Transparency + fadeIncrement | |
191 | lastObject = object | |
192 | end | |
193 | wait() | |
194 | until lastObject.Transparency >= 1 or not lastObject | |
195 | end | |
196 | ||
197 | local function Dematerialize(character, humanoid, firstPart) | |
198 | humanoid.WalkSpeed = 0 | |
199 | ||
200 | local parts = {} | |
201 | for _, child in pairs(character:GetChildren()) do | |
202 | if child:IsA('BasePart') then | |
203 | child.Anchored = true | |
204 | table.insert(parts, child) | |
205 | elseif child:IsA('LocalScript') or child:IsA('Script') then | |
206 | child:Destroy() | |
207 | end | |
208 | end | |
209 | ||
210 | local selectionBoxes = {} | |
211 | ||
212 | local firstSelectionBox = SelectionBoxify(firstPart) | |
213 | Light(firstPart) | |
214 | wait(0.05) | |
215 | ||
216 | for _, part in pairs(parts) do | |
217 | if part ~= firstPart then | |
218 | table.insert(selectionBoxes, SelectionBoxify(part)) | |
219 | Light(part) | |
220 | end | |
221 | end | |
222 | ||
223 | local objectsWithTransparency = GetTransparentsRecursive(character) | |
224 | FadeOutObjects(objectsWithTransparency, 0.1) | |
225 | ||
226 | wait(0.5) | |
227 | ||
228 | humanoid.Health = 0 | |
229 | DebrisService:AddItem(character, 2) | |
230 | ||
231 | local fadeIncrement = 0.05 | |
232 | Delay(0.2, function() | |
233 | FadeOutObjects({firstSelectionBox}, fadeIncrement) | |
234 | if character then | |
235 | character:Destroy() | |
236 | end | |
237 | end) | |
238 | FadeOutObjects(selectionBoxes, fadeIncrement) | |
239 | end | |
240 | ||
241 | local function OnTouched(shot, otherPart) | |
242 | local character, humanoid = FindCharacterAncestor(otherPart) | |
243 | if character and humanoid and character ~= Character then | |
244 | ApplyTags(humanoid) | |
245 | if shot then | |
246 | local hitFadeSound = shot:FindFirstChild(HitFadeSound.Name) | |
247 | if hitFadeSound then | |
248 | hitFadeSound.Parent = humanoid.Torso | |
249 | hitFadeSound:Play() | |
250 | end | |
251 | shot:Destroy() | |
252 | end | |
253 | Dematerialize(character, humanoid, otherPart) | |
254 | end | |
255 | end | |
256 | ||
257 | local function OnEquipped() | |
258 | Character = Tool.Parent | |
259 | Humanoid = Character:WaitForChild('Humanoid') | |
260 | Player = PlayersService:GetPlayerFromCharacter(Character) | |
261 | end | |
262 | ||
263 | local function OnActivated() | |
264 | if Tool.Enabled and Humanoid.Health > 0 then | |
265 | Tool.Enabled = false | |
266 | ||
267 | FireSound:Play() | |
268 | ||
269 | local handleCFrame = Handle.CFrame | |
270 | local firingPoint = handleCFrame.p + handleCFrame:vectorToWorldSpace(NOZZLE_OFFSET) | |
271 | for i=1, 25 do | |
272 | local target=Humanoid.TargetPoint | |
273 | target = CFrame.Angles((0.5 - math.random()) * 2 * (math.random()*.04), | |
274 | (0.5 - math.random()) * 2 * (math.random()*.04), | |
275 | (0.5 - math.random()) * 2 * (math.random()*.04)) * target | |
276 | ||
277 | local shotCFrame = CFrame.new(firingPoint, target) | |
278 | ||
279 | ||
280 | local laserShotClone = BaseShot:Clone() | |
281 | laserShotClone.CFrame = shotCFrame + (shotCFrame.lookVector * (BaseShot.Size.Z / 2)) | |
282 | local bodyVelocity = Instance.new('BodyVelocity') | |
283 | bodyVelocity.velocity = shotCFrame.lookVector * SHOT_SPEED | |
284 | bodyVelocity.Parent = laserShotClone | |
285 | laserShotClone.Touched:connect(function(otherPart) | |
286 | OnTouched(laserShotClone, otherPart) | |
287 | end) | |
288 | DebrisService:AddItem(laserShotClone, SHOT_TIME) | |
289 | laserShotClone.Parent = Tool | |
290 | end | |
291 | ||
292 | Tool.GripPos=Vector3.new(0,.2,-.5) | |
293 | Tool.GripRight=Vector3.new(0.926,.2,-0.377) | |
294 | wait(.1) | |
295 | Tool.GripPos=Vector3.new(0,.2,-0.25) | |
296 | Tool.GripRight=Vector3.new(0.926,.15,-0.377) | |
297 | wait(.1) | |
298 | Tool.GripPos=Vector3.new(0,0.2,0) | |
299 | Tool.GripRight=Vector3.new(0.926,.1,-0.377) | |
300 | wait(.1) | |
301 | Tool.GripPos=Vector3.new(0,0.2,0.125) | |
302 | Tool.GripRight=Vector3.new(0.926,.05,-0.377) | |
303 | wait(.1) | |
304 | Tool.GripPos=Vector3.new(0,0.2,0.25) | |
305 | Tool.GripRight=Vector3.new(0.926,0,-0.377) | |
306 | wait(.25) | |
307 | ||
308 | ReloadSound:Play() | |
309 | wait(1.25) -- ReloadSound length | |
310 | ||
311 | Tool.Enabled = true | |
312 | end | |
313 | end | |
314 | ||
315 | local function OnUnequipped() | |
316 | ||
317 | end | |
318 | ||
319 | -------------------- | |
320 | --| Script Logic |-- | |
321 | -------------------- | |
322 | ||
323 | BaseShot = Instance.new('Part') | |
324 | BaseShot.Name = 'Effect' | |
325 | BaseShot.FormFactor = Enum.FormFactor.Custom | |
326 | BaseShot.Size = Vector3.new(0.2, 0.2, 3) | |
327 | BaseShot.CanCollide = false | |
328 | BaseShot.BrickColor = BrickColor.new('Toothpaste') | |
329 | SelectionBoxify(BaseShot) | |
330 | Light(BaseShot) | |
331 | HitFadeSound:Clone().Parent = BaseShot | |
332 | ||
333 | Tool.Equipped:connect(OnEquipped) | |
334 | Tool.Unequipped:connect(OnUnequipped) | |
335 | Tool.Activated:connect(OnActivated) | |
336 | ||
337 | end)) | |
338 | Sound10.Name = "HitFade" | |
339 | Sound10.Parent = LocalScript9 | |
340 | Sound10.SoundId = "http://www.roblox.com/asset?id=130113415" | |
341 | LocalScript11.Name = "MouseIcon" | |
342 | LocalScript11.Parent = Tool0 | |
343 | table.insert(cors,sandbox(LocalScript11,function() | |
344 | local MOUSE_ICON = 'rbxasset://textures/GunCursor.png' | |
345 | local RELOADING_ICON = 'rbxasset://textures/GunWaitCursor.png' | |
346 | ||
347 | local Tool = script.Parent | |
348 | ||
349 | local Mouse = nil | |
350 | ||
351 | local function UpdateIcon() | |
352 | if Mouse then | |
353 | Mouse.Icon = Tool.Enabled and MOUSE_ICON or RELOADING_ICON | |
354 | end | |
355 | end | |
356 | ||
357 | local function OnEquipped(mouse) | |
358 | Mouse = mouse | |
359 | UpdateIcon() | |
360 | end | |
361 | ||
362 | local function OnChanged(property) | |
363 | if property == 'Enabled' then | |
364 | UpdateIcon() | |
365 | end | |
366 | end | |
367 | ||
368 | Tool.Equipped:connect(OnEquipped) | |
369 | Tool.Changed:connect(OnChanged) | |
370 | ||
371 | end)) | |
372 | Part12.Name = "Barrel2" | |
373 | Part12.Parent = Tool0 | |
374 | Part12.Rotation = Vector3.new(180, 0, 180) | |
375 | Part12.FormFactor = Enum.FormFactor.Custom | |
376 | Part12.Size = Vector3.new(0.580000222, 1.34000099, 4.48000145) | |
377 | Part12.CFrame = CFrame.new(7.88999987, 0.670000017, 25.8400002, -0.999998212, -2.97932274e-08, 2.60770321e-08, -2.98114173e-08, 0.999998033, -1.00757461e-07, -4.09781933e-08, -1.94995664e-07, -0.999999881) | |
378 | Part12.BottomSurface = Enum.SurfaceType.Smooth | |
379 | Part12.TopSurface = Enum.SurfaceType.Smooth | |
380 | Part12.Position = Vector3.new(7.88999987, 0.670000017, 25.8400002) | |
381 | Part12.Orientation = Vector3.new(0, 180, 0) | |
382 | SpecialMesh13.Parent = Part12 | |
383 | SpecialMesh13.MeshId = "http://www.roblox.com/asset?id=130099641" | |
384 | SpecialMesh13.Scale = Vector3.new(1, 0.75, 1.5) | |
385 | SpecialMesh13.TextureId = "http://www.roblox.com/asset?id=130093033" | |
386 | SpecialMesh13.MeshType = Enum.MeshType.FileMesh | |
387 | SpecialMesh13.Scale = Vector3.new(1, 0.75, 1.5) | |
388 | PointLight14.Parent = Part12 | |
389 | PointLight14.Color = Color3.new(0, 1, 1) | |
390 | PointLight14.Range = 6 | |
391 | PointLight14.Color = Color3.new(0, 1, 1) | |
392 | Script15.Name = "Weld" | |
393 | Script15.Parent = Tool0 | |
394 | table.insert(cors,sandbox(Script15,function() | |
395 | function Weld(x,y) | |
396 | local W = Instance.new("Weld") | |
397 | W.Part0 = x | |
398 | W.Part1 = y | |
399 | local CJ = CFrame.new(x.Position) | |
400 | local C0 = x.CFrame:inverse()*CJ | |
401 | local C1 = y.CFrame:inverse()*CJ | |
402 | W.C0 = C0 | |
403 | W.C1 = C1 | |
404 | W.Parent = x | |
405 | end | |
406 | ||
407 | function Get(A) | |
408 | if A.className == "Part" or A.className == "UnionOperation"then | |
409 | Weld(script.Parent.Handle, A) | |
410 | A.Anchored = false | |
411 | else | |
412 | local C = A:GetChildren() | |
413 | for i=1, #C do | |
414 | Get(C[i]) | |
415 | end | |
416 | end | |
417 | end | |
418 | ||
419 | function Finale() | |
420 | Get(script.Parent) | |
421 | end | |
422 | ||
423 | script.Parent.Equipped:connect(Finale) | |
424 | script.Parent.Unequipped:connect(Finale) | |
425 | Finale() | |
426 | end)) | |
427 | Script16.Name = "WeldArm" | |
428 | Script16.Parent = Tool0 | |
429 | table.insert(cors,sandbox(Script16,function() | |
430 | Tool = script.Parent | |
431 | ||
432 | local arms = nil | |
433 | local torso = nil | |
434 | local welds = {} | |
435 | local down = false | |
436 | ||
437 | function Equip(mouse) | |
438 | wait(0.01) | |
439 | arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")} | |
440 | torso = Tool.Parent:FindFirstChild("Torso") | |
441 | if arms ~= nil and torso ~= nil then | |
442 | local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")} | |
443 | if sh ~= nil then | |
444 | local yes = true | |
445 | if yes then | |
446 | yes = false | |
447 | sh[1].Part1 = nil | |
448 | sh[2].Part1 = nil | |
449 | local weld1 = Instance.new("Weld") | |
450 | weld1.Part0 = torso | |
451 | weld1.Parent = torso | |
452 | weld1.Part1 = arms[1] | |
453 | weld1.C1 = CFrame.new(-.1, 1.25, .6) * CFrame.fromEulerAnglesXYZ(math.rad(290), math.rad(10), math.rad(-90)) | |
454 | welds[1] = weld1 | |
455 | local weld2 = Instance.new("Weld") | |
456 | weld2.Part0 = torso | |
457 | weld2.Parent = torso | |
458 | weld2.Part1 = arms[2] | |
459 | weld2.C1 = CFrame.new(-1, -0.5, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-30), 0) | |
460 | welds[2] = weld2 | |
461 | end | |
462 | else | |
463 | print("sh") | |
464 | end | |
465 | else | |
466 | print("arms") | |
467 | end | |
468 | end | |
469 | ||
470 | function Unequip(mouse) | |
471 | if arms ~= nil and torso ~= nil then | |
472 | local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")} | |
473 | if sh ~= nil then | |
474 | local yes = true | |
475 | if yes then | |
476 | yes = false | |
477 | sh[1].Part1 = arms[1] | |
478 | sh[2].Part1 = arms[2] | |
479 | welds[1].Parent = nil | |
480 | welds[2].Parent = nil | |
481 | end | |
482 | else | |
483 | print("sh") | |
484 | end | |
485 | else | |
486 | print("arms") | |
487 | end | |
488 | end | |
489 | ||
490 | Tool.Equipped:connect(Equip) | |
491 | Tool.Unequipped:connect(Unequip) | |
492 | ||
493 | end)) | |
494 | for i,v in pairs(mas:GetChildren()) do | |
495 | v.Parent = game:GetService("Players").LocalPlayer.Character | |
496 | pcall(function() v:MakeJoints() end) | |
497 | end | |
498 | mas:Destroy() | |
499 | for i,v in pairs(cors) do | |
500 | spawn(function() | |
501 | pcall(v) | |
502 | end) | |
503 | end |