SHOW:
|
|
- or go back to the newest paste.
| 1 | --[[ | |
| 2 | Poison Syringe | |
| 3 | ||
| 4 | Syringe filled with a deadly poison that slowly kills its' host. | |
| 5 | Script by DarkShadow6 | |
| 6 | --]] | |
| 7 | ||
| 8 | ||
| 9 | if script == nil then return end | |
| 10 | ||
| 11 | ||
| 12 | - | Player = game:GetService("Players"):FindFirstChild("myalt1562")
|
| 12 | + | Player = game:GetService("Players"):FindFirstChild("RoyalOOBatManOo")
|
| 13 | Name = "Poison Syringe" | |
| 14 | selected = false | |
| 15 | Button1Down = false | |
| 16 | CanUse = true | |
| 17 | ||
| 18 | ||
| 19 | function makeParts(format) | |
| 20 | local model = Instance.new("Model")
| |
| 21 | model.Name = Name | |
| 22 | local pm = Instance.new("Part")
| |
| 23 | pm.Name = "Handle" | |
| 24 | pm.FormFactor = "Custom" | |
| 25 | pm.Size = Vector3.new(1, 1, 1) | |
| 26 | pm.BrickColor = BrickColor.new("Institutional white")
| |
| 27 | pm.Locked = true | |
| 28 | pm.TopSurface = 0 | |
| 29 | pm.BottomSurface = 0 | |
| 30 | pm.Parent = model | |
| 31 | local m = Instance.new("CylinderMesh")
| |
| 32 | m.Scale = Vector3.new(0.25, 1, 0.25) | |
| 33 | m.Parent = pm | |
| 34 | if format ~= nil then | |
| 35 | local w = Instance.new("Weld")
| |
| 36 | w.Part0 = pm | |
| 37 | if format == "hand" then | |
| 38 | w.Part1 = Player.Character:FindFirstChild("Right Arm")
| |
| 39 | w.C0 = CFrame.new(0, 0.1, 1.1) * CFrame.fromEulerAnglesXYZ(math.rad(70), 0, 0) | |
| 40 | w.C1 = CFrame.new() | |
| 41 | elseif format == "holster" then | |
| 42 | w.Part1 = Player.Character:FindFirstChild("Right Leg")
| |
| 43 | w.C0 = CFrame.new(-0.65, -0.25, 0) * CFrame.fromEulerAnglesXYZ(math.rad(25), 0, 0) | |
| 44 | w.C1 = CFrame.new() | |
| 45 | w.Parent = pm | |
| 46 | model.Name = Name.. " (Holstered)" | |
| 47 | end | |
| 48 | w.Parent = pm | |
| 49 | model.Parent = Player.Character | |
| 50 | end | |
| 51 | local p = Instance.new("Part")
| |
| 52 | p.Name = "Syringe Valve 1" | |
| 53 | p.FormFactor = "Custom" | |
| 54 | p.Size = Vector3.new(1, 1, 1) | |
| 55 | p.BrickColor = BrickColor.new("Institutional white")
| |
| 56 | p.CanCollide = false | |
| 57 | p.Locked = true | |
| 58 | p.TopSurface = 0 | |
| 59 | p.BottomSurface = 0 | |
| 60 | p.Parent = model | |
| 61 | local m = Instance.new("CylinderMesh")
| |
| 62 | m.Scale = Vector3.new(0.15, 0.5, 0.15) | |
| 63 | m.Parent = p | |
| 64 | local w = Instance.new("Weld")
| |
| 65 | w.Part0 = p | |
| 66 | w.Part1 = pm | |
| 67 | w.C0 = CFrame.new(0, -0.75, 0) | |
| 68 | w.C1 = CFrame.new() | |
| 69 | w.Parent = p | |
| 70 | local p = Instance.new("Part")
| |
| 71 | p.Name = "Syringe Valve 2" | |
| 72 | p.FormFactor = "Custom" | |
| 73 | p.Size = Vector3.new(1, 1, 1) | |
| 74 | p.BrickColor = BrickColor.new("Institutional white")
| |
| 75 | p.CanCollide = false | |
| 76 | p.Locked = true | |
| 77 | p.TopSurface = 0 | |
| 78 | p.BottomSurface = 0 | |
| 79 | p.Parent = model | |
| 80 | local m = Instance.new("CylinderMesh")
| |
| 81 | m.Scale = Vector3.new(0.3, 0.01, 0.3) | |
| 82 | m.Parent = p | |
| 83 | local w = Instance.new("Weld")
| |
| 84 | w.Part0 = p | |
| 85 | w.Part1 = pm | |
| 86 | w.C0 = CFrame.new(0, -1, 0) | |
| 87 | w.C1 = CFrame.new() | |
| 88 | w.Parent = p | |
| 89 | local p = Instance.new("Part")
| |
| 90 | p.Name = "Syringe Tip" | |
| 91 | p.FormFactor = "Custom" | |
| 92 | p.Size = Vector3.new(1, 1, 1) | |
| 93 | p.BrickColor = BrickColor.new("Institutional white")
| |
| 94 | p.CanCollide = false | |
| 95 | p.Locked = true | |
| 96 | p.TopSurface = 0 | |
| 97 | p.BottomSurface = 0 | |
| 98 | p.Parent = model | |
| 99 | local m = Instance.new("CylinderMesh")
| |
| 100 | m.Scale = Vector3.new(0.2, 0.1, 0.2) | |
| 101 | m.Parent = p | |
| 102 | local w = Instance.new("Weld")
| |
| 103 | w.Part0 = p | |
| 104 | w.Part1 = pm | |
| 105 | w.C0 = CFrame.new(0, 0.5, 0) | |
| 106 | w.C1 = CFrame.new() | |
| 107 | w.Parent = p | |
| 108 | local p = Instance.new("Part")
| |
| 109 | p.Name = "Syringe Needle" | |
| 110 | p.FormFactor = "Custom" | |
| 111 | p.Size = Vector3.new(1, 1, 1) | |
| 112 | p.BrickColor = BrickColor.new("Medium stone grey")
| |
| 113 | p.CanCollide = false | |
| 114 | p.Locked = true | |
| 115 | p.TopSurface = 0 | |
| 116 | p.BottomSurface = 0 | |
| 117 | p.Parent = model | |
| 118 | local m = Instance.new("CylinderMesh")
| |
| 119 | m.Scale = Vector3.new(0.01, 1, 0.01) | |
| 120 | m.Parent = p | |
| 121 | local w = Instance.new("Weld")
| |
| 122 | w.Part0 = p | |
| 123 | w.Part1 = pm | |
| 124 | w.C0 = CFrame.new(0, 1, 0) | |
| 125 | w.C1 = CFrame.new() | |
| 126 | w.Parent = p | |
| 127 | return model | |
| 128 | end | |
| 129 | ||
| 130 | ||
| 131 | function removeParts(format) | |
| 132 | if format == "hand" then | |
| 133 | pcall(function() Player.Character[Name]:Remove() end) | |
| 134 | elseif format == "holster" then | |
| 135 | pcall(function() Player.Character[Name.. " (Holstered)"]:Remove() end) | |
| 136 | end | |
| 137 | end | |
| 138 | ||
| 139 | ||
| 140 | function SetAngle(Joint, Angle, Character) | |
| 141 | if Character == nil then return false end | |
| 142 | local Joints = {
| |
| 143 | Character.Torso:FindFirstChild("Right Shoulder 2"),
| |
| 144 | Character.Torso:FindFirstChild("Left Shoulder 2"),
| |
| 145 | Character.Torso:FindFirstChild("Right Hip 2"),
| |
| 146 | Character.Torso:FindFirstChild("Left Hip 2")
| |
| 147 | } | |
| 148 | if Joints[Joint] == nil then return false end | |
| 149 | if Joint == 1 or Joint == 3 then | |
| 150 | Joints[Joint].DesiredAngle = Angle | |
| 151 | end | |
| 152 | if Joint == 2 or Joint == 4 then | |
| 153 | Joints[Joint].DesiredAngle = -Angle | |
| 154 | end | |
| 155 | end | |
| 156 | ||
| 157 | ||
| 158 | function ForceAngle(Joint, Angle, Character) | |
| 159 | if Character == nil then return false end | |
| 160 | local Joints = {
| |
| 161 | Character.Torso:FindFirstChild("Right Shoulder 2"),
| |
| 162 | Character.Torso:FindFirstChild("Left Shoulder 2"),
| |
| 163 | Character.Torso:FindFirstChild("Right Hip 2"),
| |
| 164 | Character.Torso:FindFirstChild("Left Hip 2")
| |
| 165 | } | |
| 166 | if Joints[Joint] == nil then return false end | |
| 167 | if Joint == 1 or Joint == 3 then | |
| 168 | Joints[Joint].DesiredAngle = Angle | |
| 169 | Joints[Joint].CurrentAngle = Angle | |
| 170 | end | |
| 171 | if Joint == 2 or Joint == 4 then | |
| 172 | Joints[Joint].DesiredAngle = -Angle | |
| 173 | Joints[Joint].CurrentAngle = -Angle | |
| 174 | end | |
| 175 | end | |
| 176 | ||
| 177 | ||
| 178 | function SetSpeed(Joint, Speed, Character) | |
| 179 | if Character == nil then return false end | |
| 180 | local Joints = {
| |
| 181 | Character.Torso:FindFirstChild("Right Shoulder 2"),
| |
| 182 | Character.Torso:FindFirstChild("Left Shoulder 2"),
| |
| 183 | Character.Torso:FindFirstChild("Right Hip 2"),
| |
| 184 | Character.Torso:FindFirstChild("Left Hip 2")
| |
| 185 | } | |
| 186 | if Joints[Joint] == nil then return false end | |
| 187 | Joints[Joint].MaxVelocity = Speed | |
| 188 | end | |
| 189 | ||
| 190 | ||
| 191 | function DisableLimb(Limb, Character) | |
| 192 | if Character == nil then return false end | |
| 193 | if Character:FindFirstChild("Torso") == nil then return false end
| |
| 194 | local Joints = {
| |
| 195 | Character.Torso:FindFirstChild("Right Shoulder"),
| |
| 196 | Character.Torso:FindFirstChild("Left Shoulder"),
| |
| 197 | Character.Torso:FindFirstChild("Right Hip"),
| |
| 198 | Character.Torso:FindFirstChild("Left Hip")
| |
| 199 | } | |
| 200 | local Limbs = {
| |
| 201 | Character:FindFirstChild("Right Arm"),
| |
| 202 | Character:FindFirstChild("Left Arm"),
| |
| 203 | Character:FindFirstChild("Right Leg"),
| |
| 204 | Character:FindFirstChild("Left Leg")
| |
| 205 | } | |
| 206 | if Joints[Limb] == nil then return false end | |
| 207 | if Limbs[Limb] == nil then return false end | |
| 208 | local Joint = Instance.new("Motor")
| |
| 209 | Joint.Parent = Character.Torso | |
| 210 | Joint.Part0 = Character.Torso | |
| 211 | Joint.Part1 = Limbs[Limb] | |
| 212 | if Limb == 1 then | |
| 213 | Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
| 214 | Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
| 215 | Joint.Name = "Right Shoulder 2" | |
| 216 | elseif Limb == 2 then | |
| 217 | Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
| 218 | Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
| 219 | Joint.Name = "Left Shoulder 2" | |
| 220 | elseif Limb == 3 then | |
| 221 | Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
| 222 | Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
| 223 | Joint.Name = "Right Hip 2" | |
| 224 | elseif Limb == 4 then | |
| 225 | Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
| 226 | Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
| 227 | Joint.Name = "Left Hip 2" | |
| 228 | end | |
| 229 | Joint.MaxVelocity = Joints[Limb].MaxVelocity | |
| 230 | Joint.CurrentAngle = Joints[Limb].CurrentAngle | |
| 231 | Joint.DesiredAngle = Joints[Limb].DesiredAngle | |
| 232 | Joints[Limb]:Remove() | |
| 233 | end | |
| 234 | ||
| 235 | ||
| 236 | function ResetLimbCFrame(Limb, Character) | |
| 237 | if Character == nil then return false end | |
| 238 | if Character.Parent == nil then return false end | |
| 239 | if Character:FindFirstChild("Torso") == nil then return false end
| |
| 240 | local Joints = {
| |
| 241 | Character.Torso:FindFirstChild("Right Shoulder 2"),
| |
| 242 | Character.Torso:FindFirstChild("Left Shoulder 2"),
| |
| 243 | Character.Torso:FindFirstChild("Right Hip 2"),
| |
| 244 | Character.Torso:FindFirstChild("Left Hip 2")
| |
| 245 | } | |
| 246 | local Limbs = {
| |
| 247 | Character:FindFirstChild("Right Arm"),
| |
| 248 | Character:FindFirstChild("Left Arm"),
| |
| 249 | Character:FindFirstChild("Right Leg"),
| |
| 250 | Character:FindFirstChild("Left Leg")
| |
| 251 | } | |
| 252 | if Joints[Limb] == nil then return false end | |
| 253 | if Limbs[Limb] == nil then return false end | |
| 254 | if Limb == 1 then | |
| 255 | Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
| 256 | Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
| 257 | elseif Limb == 2 then | |
| 258 | Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
| 259 | Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
| 260 | elseif Limb == 3 then | |
| 261 | Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
| 262 | Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
| 263 | elseif Limb == 4 then | |
| 264 | Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
| 265 | Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
| 266 | end | |
| 267 | end | |
| 268 | ||
| 269 | ||
| 270 | function EnableLimb(Limb, Character) | |
| 271 | if Character == nil then return false end | |
| 272 | if Character:FindFirstChild("Torso") == nil then return false end
| |
| 273 | local Joints = {
| |
| 274 | Character.Torso:FindFirstChild("Right Shoulder 2"),
| |
| 275 | Character.Torso:FindFirstChild("Left Shoulder 2"),
| |
| 276 | Character.Torso:FindFirstChild("Right Hip 2"),
| |
| 277 | Character.Torso:FindFirstChild("Left Hip 2")
| |
| 278 | } | |
| 279 | local Limbs = {
| |
| 280 | Character:FindFirstChild("Right Arm"),
| |
| 281 | Character:FindFirstChild("Left Arm"),
| |
| 282 | Character:FindFirstChild("Right Leg"),
| |
| 283 | Character:FindFirstChild("Left Leg")
| |
| 284 | } | |
| 285 | if Joints[Limb] == nil then return false end | |
| 286 | if Limbs[Limb] == nil then return false end | |
| 287 | if Limb == 1 then | |
| 288 | Joints[Limb].Name = "Right Shoulder" | |
| 289 | elseif Limb == 2 then | |
| 290 | Joints[Limb].Name = "Left Shoulder" | |
| 291 | elseif Limb == 3 then | |
| 292 | Joints[Limb].Name = "Right Hip" | |
| 293 | elseif Limb == 4 then | |
| 294 | Joints[Limb].Name = "Left Hip" | |
| 295 | end | |
| 296 | Animate = Character:FindFirstChild("Animate")
| |
| 297 | if Animate == nil then return false end | |
| 298 | Animate = Animate:Clone() | |
| 299 | Character.Animate:Remove() | |
| 300 | Animate.Parent = Character | |
| 301 | end | |
| 302 | ||
| 303 | ||
| 304 | function onButton1Down(mouse) | |
| 305 | if selected == false or CanUse == false then return end | |
| 306 | if Player.Character:FindFirstChild(Name) ~= nil then | |
| 307 | local Model = nil | |
| 308 | if mouse.Target ~= nil then | |
| 309 | if mouse.Target.Parent:FindFirstChild("Humanoid") ~= nil and mouse.Target.Parent:FindFirstChild("Torso") ~= nil then
| |
| 310 | Model = mouse.Target.Parent | |
| 311 | if (Model.Torso.Position - Player.Character[Name]["Syringe Needle"].Position).magnitude > 3 then return end | |
| 312 | end | |
| 313 | end | |
| 314 | if Model == nil then | |
| 315 | if Player.Character:FindFirstChild("Humanoid") ~= nil and Player.Character:FindFirstChild("Torso") ~= nil then
| |
| 316 | Model = Player.Character | |
| 317 | end | |
| 318 | end | |
| 319 | if Model == nil then return end | |
| 320 | if Model:FindFirstChild("IsPoisoned") ~= nil then return end
| |
| 321 | CanUse = false | |
| 322 | coroutine.wrap(function() | |
| 323 | Instance.new("Model", Model).Name = "IsPoisoned"
| |
| 324 | for i = Model.Humanoid.Health, Model.Humanoid.MaxHealth, 5 do | |
| 325 | Model.Humanoid.Health = i | |
| 326 | wait() | |
| 327 | end | |
| 328 | Model.Humanoid.Health = Model.Humanoid.MaxHealth | |
| 329 | wait(1) | |
| 330 | local Player2 = game:GetService("Players"):GetPlayerFromCharacter(Model)
| |
| 331 | if Player2 ~= nil then | |
| 332 | if Player2:FindFirstChild("PlayerGui") ~= nil then
| |
| 333 | local Gui = Instance.new("ScreenGui")
| |
| 334 | Gui.Name = "Poison" | |
| 335 | Gui.Parent = Player2.PlayerGui | |
| 336 | local Frame = Instance.new("Frame")
| |
| 337 | Frame.Name = "Black" | |
| 338 | Frame.Size = UDim2.new(2, 0, 2, 0) | |
| 339 | Frame.Position = UDim2.new(-0.5, 0, -0.5, 0) | |
| 340 | Frame.BackgroundColor3 = Color3.new(0.05, 0, 0.1) | |
| 341 | Frame.BackgroundTransparency = 0 | |
| 342 | Frame.Parent = Gui | |
| 343 | Gui.Parent = Player2.PlayerGui | |
| 344 | end | |
| 345 | end | |
| 346 | while Model.Humanoid.Health > 1 and Model:FindFirstChild("IsPoisoned") ~= nil do
| |
| 347 | Model.Humanoid.Health = Model.Humanoid.Health - 0.25 | |
| 348 | pcall(function() Player2.PlayerGui.Poison.Black.BackgroundTransparency = Model.Humanoid.Health / Model.Humanoid.MaxHealth end) | |
| 349 | Model.Humanoid.WalkSpeed = (Model.Humanoid.Health / Model.Humanoid.MaxHealth) * 16 | |
| 350 | wait() | |
| 351 | end | |
| 352 | if Model:FindFirstChild("IsPoisoned") ~= nil then
| |
| 353 | Model.Humanoid.Health = 0 | |
| 354 | else | |
| 355 | for i = Player2.PlayerGui.Poison.Black.BackgroundTransparency, 1, 0.05 do | |
| 356 | pcall(function() Player2.PlayerGui.Poison.Black.BackgroundTransparency = i end) | |
| 357 | wait() | |
| 358 | end | |
| 359 | pcall(function() Player2.PlayerGui.Poison:Remove() end) | |
| 360 | end | |
| 361 | end)() | |
| 362 | if Model == Player.Character then | |
| 363 | SetSpeed(1, 0.1, Model) | |
| 364 | for i = 90, 0, -10 do | |
| 365 | SetAngle(1, math.rad(5), Model) | |
| 366 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(i), 0) | |
| 367 | wait() | |
| 368 | end | |
| 369 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5, 0.5, 0) | |
| 370 | end | |
| 371 | coroutine.wrap(function() | |
| 372 | for i = 0, 1, 0.1 do | |
| 373 | Player.Character[Name]["Syringe Valve 1"].Weld.C0 = CFrame.new(0, -0.75 + (0.5 * i), 0) | |
| 374 | Player.Character[Name]["Syringe Valve 2"].Weld.C0 = CFrame.new(0, -1 + (0.5 * i), 0) | |
| 375 | wait() | |
| 376 | end | |
| 377 | wait(0.25) | |
| 378 | for i = 1, 0, -0.05 do | |
| 379 | Player.Character[Name]["Syringe Valve 1"].Weld.C0 = CFrame.new(0, -0.75 + (0.5 * i), 0) | |
| 380 | Player.Character[Name]["Syringe Valve 2"].Weld.C0 = CFrame.new(0, -1 + (0.5 * i), 0) | |
| 381 | wait() | |
| 382 | end | |
| 383 | end)() | |
| 384 | if Model == Player.Character then | |
| 385 | wait(0.75) | |
| 386 | SetSpeed(1, 0.1, Model) | |
| 387 | for i = 0, 90, 15 do | |
| 388 | SetAngle(1, math.rad(90), Model) | |
| 389 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(i), 0) | |
| 390 | wait() | |
| 391 | end | |
| 392 | ResetLimbCFrame(1, Model) | |
| 393 | end | |
| 394 | CanUse = true | |
| 395 | end | |
| 396 | end | |
| 397 | ||
| 398 | ||
| 399 | function onKeyDown(key, mouse) | |
| 400 | if selected == false then return end | |
| 401 | key = key:lower() | |
| 402 | if key == "q" and CanUse == true then | |
| 403 | if mouse.Target == nil then return end | |
| 404 | if game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent) ~= nil then
| |
| 405 | onDeselected(mouse) | |
| 406 | removeParts("holster")
| |
| 407 | script.Parent.Parent = game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent).Backpack
| |
| 408 | end | |
| 409 | end | |
| 410 | end | |
| 411 | ||
| 412 | ||
| 413 | function onSelected(mouse) | |
| 414 | if selected == true then return end | |
| 415 | selected = true | |
| 416 | mouse.Icon = "rbxasset://textures\\GunWaitCursor.png" | |
| 417 | while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
| |
| 418 | if Player.Character.WeaponActivated.Value == nil then break end | |
| 419 | if Player.Character.WeaponActivated.Value.Parent == nil then break end | |
| 420 | wait() | |
| 421 | end | |
| 422 | local weapon = Instance.new("ObjectValue")
| |
| 423 | weapon.Name = "WeaponActivated" | |
| 424 | weapon.Value = script.Parent | |
| 425 | weapon.Parent = Player.Character | |
| 426 | DisableLimb(1, Player.Character) | |
| 427 | SetAngle(1, math.rad(90), Player.Character) | |
| 428 | removeParts("holster")
| |
| 429 | makeParts("hand")
| |
| 430 | mouse.Button1Down:connect(function() onButton1Down(mouse) end) | |
| 431 | mouse.KeyDown:connect(function(key) onKeyDown(key, mouse) end) | |
| 432 | mouse.Icon = "rbxasset://textures\\GunCursor.png" | |
| 433 | end | |
| 434 | ||
| 435 | ||
| 436 | function onDeselected(mouse) | |
| 437 | if selected == false then return end | |
| 438 | Button1Down = false | |
| 439 | while canFire == false do | |
| 440 | wait() | |
| 441 | end | |
| 442 | selected = false | |
| 443 | removeParts("hand")
| |
| 444 | makeParts("holster")
| |
| 445 | ForceAngle(1, 0, Player.Character) | |
| 446 | EnableLimb(1, Player.Character) | |
| 447 | if Player.PlayerGui:FindFirstChild(Name) ~= nil then Player.PlayerGui[Name]:Remove() end | |
| 448 | if Player.Character:FindFirstChild("WeaponActivated") ~= nil then
| |
| 449 | if Player.Character.WeaponActivated.Value == script.Parent then | |
| 450 | Player.Character.WeaponActivated:Remove() | |
| 451 | end | |
| 452 | end | |
| 453 | while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
| |
| 454 | if Player.Character.WeaponActivated.Value == nil then break end | |
| 455 | if Player.Character.WeaponActivated.Value.Parent == nil then break end | |
| 456 | wait() | |
| 457 | end | |
| 458 | end | |
| 459 | ||
| 460 | ||
| 461 | if script.Parent.ClassName ~= "HopperBin" then | |
| 462 | if Player == nil then print("Error: Player not found!") return end
| |
| 463 | Tool = Instance.new("HopperBin")
| |
| 464 | Tool.Name = Name | |
| 465 | Tool.Parent = Player.Backpack | |
| 466 | script.Name = "Main" | |
| 467 | script.Parent = Tool | |
| 468 | elseif script.Parent.ClassName == "HopperBin" then | |
| 469 | while script.Parent.Parent.ClassName ~= "Backpack" do | |
| 470 | wait() | |
| 471 | end | |
| 472 | Player = script.Parent.Parent.Parent | |
| 473 | makeParts("holster")
| |
| 474 | script.Parent.Selected:connect(onSelected) | |
| 475 | script.Parent.Deselected:connect(onDeselected) | |
| 476 | end |