SHOW:
|
|
- or go back to the newest paste.
| 1 | --[[ | |
| 2 | Script shared by eletronix ]] | |
| 3 | ||
| 4 | if script == nil then return end | |
| 5 | ||
| 6 | ||
| 7 | Player = game.Players.LocalPlayer | |
| 8 | Name = "Artillery Beacon" | |
| 9 | selected = false | |
| 10 | Button1Down = false | |
| 11 | thrown = false | |
| 12 | ||
| 13 | ||
| 14 | function makeParts(format) | |
| 15 | local beacon = Instance.new("Model")
| |
| 16 | beacon.Name = Name | |
| 17 | beacon.Parent = Player.Character | |
| 18 | local pm = Instance.new("Part")
| |
| 19 | pm.Name = "Handle" | |
| 20 | pm.FormFactor = "Custom" | |
| 21 | pm.Size = Vector3.new(1, 1, 1) | |
| 22 | pm.BrickColor = BrickColor.new("Really black")
| |
| 23 | pm.Locked = true | |
| 24 | pm.TopSurface = 0 | |
| 25 | pm.BottomSurface = 0 | |
| 26 | pm.Parent = beacon | |
| 27 | local m = Instance.new("SpecialMesh")
| |
| 28 | m.MeshType = "Brick" | |
| 29 | m.Scale = Vector3.new(0.5, 1.25, 0.2) | |
| 30 | m.Parent = pm | |
| 31 | local w = Instance.new("Weld")
| |
| 32 | w.Part0 = pm | |
| 33 | if format == "hand" then | |
| 34 | w.Part1 = Player.Character:FindFirstChild("Right Arm")
| |
| 35 | w.C0 = CFrame.new(-1.2, 0, 0) * CFrame.fromEulerAnglesXYZ(math.rad(90), 0, math.rad(90)) | |
| 36 | w.C1 = CFrame.new() | |
| 37 | elseif format == "holster" then | |
| 38 | w.Part1 = Player.Character:FindFirstChild("Torso")
| |
| 39 | w.C0 = CFrame.new(0.7, 0.25, 0.6) | |
| 40 | w.C1 = CFrame.new() | |
| 41 | beacon.Name = Name.. " (Holstered)" | |
| 42 | end | |
| 43 | w.Parent = pm | |
| 44 | local s = Instance.new("Sound")
| |
| 45 | s.Name = "Explode" | |
| 46 | s.SoundId = "http://www.roblox.com/Asset/?id=2101148" | |
| 47 | s.Volume = 1 | |
| 48 | s.Pitch = 1 | |
| 49 | s.Looped = false | |
| 50 | s.Parent = pm | |
| 51 | local s = Instance.new("Sound")
| |
| 52 | s.Name = "Beep" | |
| 53 | s.SoundId = "http://www.roblox.com/Asset/?id=15666462" | |
| 54 | s.Volume = 1 | |
| 55 | s.Pitch = 0.75 | |
| 56 | s.Looped = true | |
| 57 | s.Parent = pm | |
| 58 | local p = Instance.new("Part")
| |
| 59 | p.Name = "Antenna" | |
| 60 | p.FormFactor = "Custom" | |
| 61 | p.Size = Vector3.new(1, 1, 1) | |
| 62 | p.BrickColor = BrickColor.new("Dark stone grey")
| |
| 63 | p.Transparency = 0 | |
| 64 | p.Locked = true | |
| 65 | p.TopSurface = 0 | |
| 66 | p.BottomSurface = 0 | |
| 67 | p.Parent = beacon | |
| 68 | local m = Instance.new("CylinderMesh")
| |
| 69 | m.Scale = Vector3.new(0.1, 0.5, 0.1) | |
| 70 | m.Parent = p | |
| 71 | local w = Instance.new("Weld")
| |
| 72 | w.Part0 = p | |
| 73 | w.Part1 = pm | |
| 74 | w.C0 = CFrame.new(0.1, -0.85, 0) | |
| 75 | w.C1 = CFrame.new() | |
| 76 | w.Parent = p | |
| 77 | local p = Instance.new("Part")
| |
| 78 | p.Name = "Light" | |
| 79 | p.FormFactor = "Custom" | |
| 80 | p.Size = Vector3.new(1, 1, 1) | |
| 81 | p.BrickColor = BrickColor.new("Bright green")
| |
| 82 | p.Transparency = 1 | |
| 83 | p.Locked = true | |
| 84 | p.TopSurface = 0 | |
| 85 | p.BottomSurface = 0 | |
| 86 | p.Parent = beacon | |
| 87 | local m = Instance.new("SpecialMesh")
| |
| 88 | m.MeshType = "Sphere" | |
| 89 | m.Scale = Vector3.new(0.1, 0.1, 0.1) | |
| 90 | m.Parent = p | |
| 91 | local w = Instance.new("Weld")
| |
| 92 | w.Part0 = p | |
| 93 | w.Part1 = pm | |
| 94 | w.C0 = CFrame.new(-0.175, -0.64, 0) | |
| 95 | w.C1 = CFrame.new() | |
| 96 | w.Parent = p | |
| 97 | end | |
| 98 | ||
| 99 | ||
| 100 | function removeParts(format) | |
| 101 | if format == "hand" then | |
| 102 | if Player.Character:FindFirstChild(Name) ~= nil then | |
| 103 | Player.Character[Name]:Remove() | |
| 104 | end | |
| 105 | elseif format == "holster" then | |
| 106 | if Player.Character:FindFirstChild(Name.. " (Holstered)") ~= nil then | |
| 107 | Player.Character[Name.. " (Holstered)"]:Remove() | |
| 108 | end | |
| 109 | end | |
| 110 | end | |
| 111 | ||
| 112 | ||
| 113 | function SetAngle(Joint, Angle, Character) | |
| 114 | if Character == nil then return false end | |
| 115 | local Joints = {
| |
| 116 | Character.Torso:FindFirstChild("Right Shoulder 2"),
| |
| 117 | Character.Torso:FindFirstChild("Left Shoulder 2"),
| |
| 118 | Character.Torso:FindFirstChild("Right Hip 2"),
| |
| 119 | Character.Torso:FindFirstChild("Left Hip 2")
| |
| 120 | } | |
| 121 | if Joints[Joint] == nil then return false end | |
| 122 | if Joint == 1 or Joint == 3 then | |
| 123 | Joints[Joint].DesiredAngle = Angle | |
| 124 | end | |
| 125 | if Joint == 2 or Joint == 4 then | |
| 126 | Joints[Joint].DesiredAngle = -Angle | |
| 127 | end | |
| 128 | end | |
| 129 | ||
| 130 | ||
| 131 | function ForceAngle(Joint, Angle, Character) | |
| 132 | if Character == nil then return false end | |
| 133 | local Joints = {
| |
| 134 | Character.Torso:FindFirstChild("Right Shoulder 2"),
| |
| 135 | Character.Torso:FindFirstChild("Left Shoulder 2"),
| |
| 136 | Character.Torso:FindFirstChild("Right Hip 2"),
| |
| 137 | Character.Torso:FindFirstChild("Left Hip 2")
| |
| 138 | } | |
| 139 | if Joints[Joint] == nil then return false end | |
| 140 | if Joint == 1 or Joint == 3 then | |
| 141 | Joints[Joint].DesiredAngle = Angle | |
| 142 | Joints[Joint].CurrentAngle = Angle | |
| 143 | end | |
| 144 | if Joint == 2 or Joint == 4 then | |
| 145 | Joints[Joint].DesiredAngle = -Angle | |
| 146 | Joints[Joint].CurrentAngle = -Angle | |
| 147 | end | |
| 148 | end | |
| 149 | ||
| 150 | ||
| 151 | function SetSpeed(Joint, Speed, Character) | |
| 152 | if Character == nil then return false end | |
| 153 | local Joints = {
| |
| 154 | Character.Torso:FindFirstChild("Right Shoulder 2"),
| |
| 155 | Character.Torso:FindFirstChild("Left Shoulder 2"),
| |
| 156 | Character.Torso:FindFirstChild("Right Hip 2"),
| |
| 157 | Character.Torso:FindFirstChild("Left Hip 2")
| |
| 158 | } | |
| 159 | if Joints[Joint] == nil then return false end | |
| 160 | Joints[Joint].MaxVelocity = Speed | |
| 161 | end | |
| 162 | ||
| 163 | ||
| 164 | function DisableLimb(Limb, Character) | |
| 165 | if Character == nil then return false end | |
| 166 | if Character:FindFirstChild("Torso") == nil then return false end
| |
| 167 | local Joints = {
| |
| 168 | Character.Torso:FindFirstChild("Right Shoulder"),
| |
| 169 | Character.Torso:FindFirstChild("Left Shoulder"),
| |
| 170 | Character.Torso:FindFirstChild("Right Hip"),
| |
| 171 | Character.Torso:FindFirstChild("Left Hip")
| |
| 172 | } | |
| 173 | local Limbs = {
| |
| 174 | Character:FindFirstChild("Right Arm"),
| |
| 175 | Character:FindFirstChild("Left Arm"),
| |
| 176 | Character:FindFirstChild("Right Leg"),
| |
| 177 | Character:FindFirstChild("Left Leg")
| |
| 178 | } | |
| 179 | if Joints[Limb] == nil then return false end | |
| 180 | if Limbs[Limb] == nil then return false end | |
| 181 | local Joint = Instance.new("Motor")
| |
| 182 | Joint.Parent = Character.Torso | |
| 183 | Joint.Part0 = Character.Torso | |
| 184 | Joint.Part1 = Limbs[Limb] | |
| 185 | if Limb == 1 then | |
| 186 | Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
| 187 | Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
| 188 | Joint.Name = "Right Shoulder 2" | |
| 189 | elseif Limb == 2 then | |
| 190 | Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
| 191 | Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
| 192 | Joint.Name = "Left Shoulder 2" | |
| 193 | elseif Limb == 3 then | |
| 194 | Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
| 195 | Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
| 196 | Joint.Name = "Right Hip 2" | |
| 197 | elseif Limb == 4 then | |
| 198 | Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
| 199 | Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
| 200 | Joint.Name = "Left Hip 2" | |
| 201 | end | |
| 202 | Joint.MaxVelocity = Joints[Limb].MaxVelocity | |
| 203 | Joint.CurrentAngle = Joints[Limb].CurrentAngle | |
| 204 | Joint.DesiredAngle = Joints[Limb].DesiredAngle | |
| 205 | Joints[Limb]:Remove() | |
| 206 | end | |
| 207 | ||
| 208 | ||
| 209 | function ResetLimbCFrame(Limb, Character) | |
| 210 | if Character == nil then return false end | |
| 211 | if Character.Parent == nil then return false end | |
| 212 | if Character:FindFirstChild("Torso") == nil then return false end
| |
| 213 | local Joints = {
| |
| 214 | Character.Torso:FindFirstChild("Right Shoulder 2"),
| |
| 215 | Character.Torso:FindFirstChild("Left Shoulder 2"),
| |
| 216 | Character.Torso:FindFirstChild("Right Hip 2"),
| |
| 217 | Character.Torso:FindFirstChild("Left Hip 2")
| |
| 218 | } | |
| 219 | local Limbs = {
| |
| 220 | Character:FindFirstChild("Right Arm"),
| |
| 221 | Character:FindFirstChild("Left Arm"),
| |
| 222 | Character:FindFirstChild("Right Leg"),
| |
| 223 | Character:FindFirstChild("Left Leg")
| |
| 224 | } | |
| 225 | if Joints[Limb] == nil then return false end | |
| 226 | if Limbs[Limb] == nil then return false end | |
| 227 | if Limb == 1 then | |
| 228 | Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
| 229 | Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
| 230 | elseif Limb == 2 then | |
| 231 | Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
| 232 | Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
| 233 | elseif Limb == 3 then | |
| 234 | Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
| 235 | Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
| 236 | elseif Limb == 4 then | |
| 237 | Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
| 238 | Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
| 239 | end | |
| 240 | end | |
| 241 | ||
| 242 | ||
| 243 | function EnableLimb(Limb, Character) | |
| 244 | if Character == nil then return false end | |
| 245 | if Character:FindFirstChild("Torso") == nil then return false end
| |
| 246 | local Joints = {
| |
| 247 | Character.Torso:FindFirstChild("Right Shoulder 2"),
| |
| 248 | Character.Torso:FindFirstChild("Left Shoulder 2"),
| |
| 249 | Character.Torso:FindFirstChild("Right Hip 2"),
| |
| 250 | Character.Torso:FindFirstChild("Left Hip 2")
| |
| 251 | } | |
| 252 | local Limbs = {
| |
| 253 | Character:FindFirstChild("Right Arm"),
| |
| 254 | Character:FindFirstChild("Left Arm"),
| |
| 255 | Character:FindFirstChild("Right Leg"),
| |
| 256 | Character:FindFirstChild("Left Leg")
| |
| 257 | } | |
| 258 | if Joints[Limb] == nil then return false end | |
| 259 | if Limbs[Limb] == nil then return false end | |
| 260 | if Limb == 1 then | |
| 261 | Joints[Limb].Name = "Right Shoulder" | |
| 262 | elseif Limb == 2 then | |
| 263 | Joints[Limb].Name = "Left Shoulder" | |
| 264 | elseif Limb == 3 then | |
| 265 | Joints[Limb].Name = "Right Hip" | |
| 266 | elseif Limb == 4 then | |
| 267 | Joints[Limb].Name = "Left Hip" | |
| 268 | end | |
| 269 | Animate = Character:FindFirstChild("Animate")
| |
| 270 | if Animate == nil then return false end | |
| 271 | Animate = Animate:Clone() | |
| 272 | Character.Animate:Remove() | |
| 273 | Animate.Parent = Character | |
| 274 | end | |
| 275 | ||
| 276 | ||
| 277 | function Weld(x, y) | |
| 278 | local weld = Instance.new("Weld")
| |
| 279 | weld.Part0 = x | |
| 280 | weld.Part1 = y | |
| 281 | CJ = CFrame.new(x.Position) | |
| 282 | C0 = x.CFrame:inverse() * CJ | |
| 283 | C1 = y.CFrame:inverse() * CJ | |
| 284 | weld.C0 = C0 | |
| 285 | weld.C1 = C1 | |
| 286 | weld.Parent = x | |
| 287 | end | |
| 288 | ||
| 289 | ||
| 290 | function tagHumanoid(humanoid) | |
| 291 | local tag = Instance.new("ObjectValue")
| |
| 292 | tag.Name = "creator" | |
| 293 | tag.Value = Player | |
| 294 | tag.Parent = humanoid | |
| 295 | local tag = Instance.new("StringValue")
| |
| 296 | tag.Name = "creatorType1" | |
| 297 | tag.Value = Name | |
| 298 | tag.Parent = humanoid | |
| 299 | local tag = Instance.new("StringValue")
| |
| 300 | tag.Name = "creatorType2" | |
| 301 | tag.Value = "blown to pieces" | |
| 302 | tag.Parent = humanoid | |
| 303 | end | |
| 304 | ||
| 305 | ||
| 306 | function untagHumanoid(humanoid) | |
| 307 | if humanoid ~= nil then | |
| 308 | local tag = humanoid:FindFirstChild("creator")
| |
| 309 | if tag ~= nil then | |
| 310 | tag:Remove() | |
| 311 | end | |
| 312 | local tag = humanoid:FindFirstChild("creatorType1")
| |
| 313 | if tag ~= nil then | |
| 314 | tag:Remove() | |
| 315 | end | |
| 316 | local tag = humanoid:FindFirstChild("creatorType2")
| |
| 317 | if tag ~= nil then | |
| 318 | tag:Remove() | |
| 319 | end | |
| 320 | end | |
| 321 | end | |
| 322 | ||
| 323 | ||
| 324 | function fire(v) | |
| 325 | if Player.Character:FindFirstChild(Name) == nil then makeParts("hand") end
| |
| 326 | if Player.Character[Name]:FindFirstChild("Handle") == nil then return end
| |
| 327 | if Player.Character[Name].Handle:FindFirstChild("Weld") ~= nil then Player.Character[Name].Handle.Weld:Remove() end
| |
| 328 | local bodyVelocity = Instance.new("BodyVelocity")
| |
| 329 | bodyVelocity.maxForce = Vector3.new(math.huge, math.huge, math.huge) | |
| 330 | bodyVelocity.velocity = v * 75 | |
| 331 | bodyVelocity.Parent = Player.Character[Name].Handle | |
| 332 | wait(0.1) | |
| 333 | bodyVelocity:Remove() | |
| 334 | end | |
| 335 | ||
| 336 | ||
| 337 | function onButton1Down(mouse) | |
| 338 | if selected == false then return end | |
| 339 | if Player.Character:FindFirstChild(Name) ~= nil and Button1Down ~= true and thrown ~= true then | |
| 340 | if Player.Character[Name]:FindFirstChild("Handle") == nil then return end
| |
| 341 | if Player.Character[Name]:FindFirstChild("Antenna") == nil then return end
| |
| 342 | if Player.Character[Name]:FindFirstChild("Light") == nil then return end
| |
| 343 | Button1Down = true | |
| 344 | mouse.Icon = "rbxasset://textures\\GunWaitCursor.png" | |
| 345 | Player.Character[Name].Light.Transparency = 0.4 | |
| 346 | coroutine.resume(coroutine.create(function(target) | |
| 347 | local pos1 = target.Position | |
| 348 | local pos2 = pos1 | |
| 349 | while true do | |
| 350 | if target == nil then return end | |
| 351 | if target.Parent == nil then return end | |
| 352 | pos2 = pos1 | |
| 353 | pos1 = target.Position | |
| 354 | local trail = Instance.new("Part")
| |
| 355 | trail.BrickColor = target.BrickColor | |
| 356 | trail.TopSurface = 0 | |
| 357 | trail.BottomSurface = 0 | |
| 358 | trail.FormFactor = target.FormFactor | |
| 359 | trail.Size = Vector3.new(1, 1, 1) | |
| 360 | trail.Reflectance = 0 | |
| 361 | trail.Transparency = 0.3 | |
| 362 | trail.Anchored = true | |
| 363 | trail.CanCollide = false | |
| 364 | trail.CFrame = CFrame.new((pos1 + pos2) / 2, pos2) | |
| 365 | trail.Parent = Workspace | |
| 366 | local mesh = Instance.new("SpecialMesh")
| |
| 367 | mesh.MeshType = "Brick" | |
| 368 | mesh.Scale = Vector3.new(0.2, 0.2, (pos2 - pos1).magnitude) | |
| 369 | mesh.Parent = trail | |
| 370 | coroutine.resume(coroutine.create(function(part) for i = 3, 10, 1 do part.Transparency = i / 10 wait(0.1) end part:Remove() end), trail) | |
| 371 | wait() | |
| 372 | end | |
| 373 | end), Player.Character[Name].Light) | |
| 374 | wait(0.5) | |
| 375 | Player.Character[Name].Handle.Beep:Play() | |
| 376 | Player.Character[Name].Light.BrickColor = BrickColor.new("Bright orange")
| |
| 377 | coroutine.resume(coroutine.create(function() | |
| 378 | wait(3) | |
| 379 | if Player.Character:FindFirstChild(Name) ~= nil then | |
| 380 | if Player.Character[Name]:FindFirstChild("Light") ~= nil then Player.Character[Name].Light.BrickColor = BrickColor.new("Really red") end
| |
| 381 | if Player.Character[Name]:FindFirstChild("Handle") ~= nil then Player.Character[Name].Handle.Beep.Pitch = 1.25 end
| |
| 382 | local position = Player.Character[Name].Handle.Position | |
| 383 | local s = Player.Character[Name].Handle.Explode:Clone() | |
| 384 | coroutine.resume(coroutine.create(function() | |
| 385 | local weld1 = Player.Character[Name].Light:FindFirstChild("Weld")
| |
| 386 | local weld2 = Player.Character[Name].Antenna:FindFirstChild("Weld")
| |
| 387 | if weld1 == nil then return end | |
| 388 | if weld2 == nil then return end | |
| 389 | local weld1c = weld1:Clone() | |
| 390 | local weld2c = weld2:Clone() | |
| 391 | while true do | |
| 392 | if Player.Character ~= nil then | |
| 393 | if Player.Character:FindFirstChild(Name) ~= nil then | |
| 394 | if weld1.Parent == nil then | |
| 395 | if Player.Character[Name]:FindFirstChild("Light") ~= nil then
| |
| 396 | weld1c:Clone().Parent = Player.Character[Name].Light | |
| 397 | Player.Character[Name]:MakeJoints() | |
| 398 | end | |
| 399 | end | |
| 400 | if weld2.Parent == nil then | |
| 401 | if Player.Character[Name]:FindFirstChild("Handle") ~= nil then
| |
| 402 | weld2c:Clone().Parent = Player.Character[Name].Antenna | |
| 403 | Player.Character[Name]:MakeJoints() | |
| 404 | end | |
| 405 | end | |
| 406 | end | |
| 407 | end | |
| 408 | wait() | |
| 409 | end | |
| 410 | end)) | |
| 411 | for i = 0, math.random(30, 50) do | |
| 412 | if Player.Character:FindFirstChild("Humanoid") ~= nil then
| |
| 413 | if Player.Character.Humanoid.Health <= 0 then break end | |
| 414 | local shell = Instance.new("Part")
| |
| 415 | shell.Name = "Artillery Shell" | |
| 416 | shell.Anchored = true | |
| 417 | shell.BrickColor = BrickColor.new("Medium stone grey")
| |
| 418 | shell.FormFactor = "Custom" | |
| 419 | shell.Size = Vector3.new(2, 5, 2) | |
| 420 | shell.TopSurface = 0 | |
| 421 | shell.BottomSurface = 0 | |
| 422 | shell.Parent = Workspace | |
| 423 | coroutine.resume(coroutine.create(function(part) | |
| 424 | local offset = Vector3.new(math.random(-50, 50), math.random(-10, 10), math.random(-50, 50)) | |
| 425 | for i = 1000, 0, -25 do | |
| 426 | part.CFrame = CFrame.new((position + offset) + Vector3.new(0, i, 0)) | |
| 427 | wait() | |
| 428 | end | |
| 429 | local e = Instance.new("Explosion")
| |
| 430 | e.Position = part.Position | |
| 431 | e.BlastPressure = 500000 | |
| 432 | e.BlastRadius = 25 | |
| 433 | e.Parent = Workspace | |
| 434 | e.Hit:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") ~= nil then tagHumanoid(hit.Parent.Humanoid) delay(1, function() untagHumanoid(hit.Parent.Humanoid) end) end end)
| |
| 435 | local s2 = s:Clone() | |
| 436 | s2.Pitch = math.random(70, 90) / 100 | |
| 437 | s2.Parent = Workspace | |
| 438 | s2:Play() | |
| 439 | part:Remove() | |
| 440 | end), shell) | |
| 441 | end | |
| 442 | wait(math.random(1, 5) / 10) | |
| 443 | end | |
| 444 | if Player.Character:FindFirstChild(Name) ~= nil then if Player.Character[Name]:FindFirstChild("Handle") ~= nil then Player.Character[Name].Handle.Beep:Stop() end end
| |
| 445 | end | |
| 446 | wait(1) | |
| 447 | removeParts("hand")
| |
| 448 | wait(1) | |
| 449 | if Player.Character:FindFirstChild("WeaponActivated") ~= nil then
| |
| 450 | Player.Character.WeaponActivated:Remove() | |
| 451 | end | |
| 452 | thrown = false | |
| 453 | Button1Down = false | |
| 454 | selected = true | |
| 455 | onDeselected(mouse) | |
| 456 | removeParts("holster")
| |
| 457 | script.Parent:Remove() | |
| 458 | end)) | |
| 459 | end | |
| 460 | end | |
| 461 | ||
| 462 | ||
| 463 | function onButton1Up(mouse) | |
| 464 | if selected == false then return end | |
| 465 | if Button1Down == true and thrown ~= true then | |
| 466 | thrown = true | |
| 467 | mouse.Icon = "rbxasset://textures\\GunCursor.png" | |
| 468 | SetSpeed(1, 0.75, Player.Character) | |
| 469 | SetAngle(1, 0, Player.Character) | |
| 470 | EnableLimb(1, Player.Character) | |
| 471 | fire((mouse.Hit.p - Player.Character[Name].Handle.Position).unit) | |
| 472 | end | |
| 473 | Button1Down = false | |
| 474 | end | |
| 475 | ||
| 476 | ||
| 477 | function onKeyDown(key, mouse) | |
| 478 | if selected == false then return end | |
| 479 | key = key:lower() | |
| 480 | if key == "q" and Button1Down == false and thrown ~= true then | |
| 481 | if mouse.Target == nil then return end | |
| 482 | if game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent) ~= nil then
| |
| 483 | onDeselected(mouse) | |
| 484 | removeParts("holster")
| |
| 485 | script.Parent.Parent = game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent).Backpack
| |
| 486 | end | |
| 487 | end | |
| 488 | end | |
| 489 | ||
| 490 | ||
| 491 | function onSelected(mouse) | |
| 492 | if selected == true then return end | |
| 493 | selected = true | |
| 494 | mouse.Icon = "rbxasset://textures\\GunWaitCursor.png" | |
| 495 | while Player.Character:FindFirstChild("WeaponActivated") ~= nil or thrown == true do
| |
| 496 | if Player.Character.WeaponActivated.Value == nil then break end | |
| 497 | if Player.Character.WeaponActivated.Value.Parent == nil then break end | |
| 498 | wait() | |
| 499 | end | |
| 500 | mouse.Icon = "rbxasset://textures\\GunCursor.png" | |
| 501 | removeParts("holster")
| |
| 502 | makeParts("hand")
| |
| 503 | local weapon = Instance.new("ObjectValue")
| |
| 504 | weapon.Name = "WeaponActivated" | |
| 505 | weapon.Value = script.Parent | |
| 506 | weapon.Parent = Player.Character | |
| 507 | DisableLimb(1, Player.Character) | |
| 508 | SetAngle(1, math.rad(200), Player.Character) | |
| 509 | mouse.Button1Down:connect(function() onButton1Down(mouse) end) | |
| 510 | mouse.Button1Up:connect(function() onButton1Up(mouse) end) | |
| 511 | mouse.KeyDown:connect(function(key) onKeyDown(key, mouse) end) | |
| 512 | end | |
| 513 | ||
| 514 | ||
| 515 | function onDeselected(mouse) | |
| 516 | if selected == false then return end | |
| 517 | selected = false | |
| 518 | while Button1Down == true or thrown == true do | |
| 519 | wait() | |
| 520 | end | |
| 521 | if Player.Character:FindFirstChild("WeaponActivated") ~= nil then
| |
| 522 | if Player.Character.WeaponActivated.Value == script.Parent then | |
| 523 | Player.Character.WeaponActivated:Remove() | |
| 524 | end | |
| 525 | end | |
| 526 | while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
| |
| 527 | if Player.Character.WeaponActivated.Value == nil then break end | |
| 528 | if pcall(function() if Player.Character.WeaponActivated.Value.Parent == nil then return true end end) then break end | |
| 529 | wait() | |
| 530 | end | |
| 531 | removeParts("hand")
| |
| 532 | makeParts("holster")
| |
| 533 | SetAngle(1, 0, Player.Character) | |
| 534 | EnableLimb(1, Player.Character) | |
| 535 | end | |
| 536 | ||
| 537 | ||
| 538 | if script.Parent.ClassName ~= "HopperBin" then | |
| 539 | if Player == nil then print("Error: Player not found!") return end
| |
| 540 | Tool = Instance.new("HopperBin")
| |
| 541 | Tool.Name = Name | |
| 542 | Tool.Parent = Player.Backpack | |
| 543 | script.Name = "Main" | |
| 544 | script.Parent = Tool | |
| 545 | end wait() if script.Parent.ClassName == "HopperBin" then | |
| 546 | while script.Parent.Parent.ClassName ~= "Backpack" do | |
| 547 | wait() | |
| 548 | end | |
| 549 | Player = script.Parent.Parent.Parent | |
| 550 | makeParts("holster")
| |
| 551 | script.Parent.Selected:connect(onSelected) | |
| 552 | script.Parent.Deselected:connect(onDeselected) | |
| 553 | end | |
| 554 | ||
| 555 | --mediafire |