SHOW:
|
|
- or go back to the newest paste.
| 1 | --An AUG ^-^ | |
| 2 | - | --Has a 30 round magazine and does lots of damage |
| 2 | + | --Has an infinity round magazine and does infinity |
| 3 | --Don't leak this. If you do i will fucking shoot you till your dead :\ | |
| 4 | local runDummyScript = function(f,scri) | |
| 5 | local oldenv = getfenv(f) | |
| 6 | local newenv = setmetatable({}, {
| |
| 7 | __index = function(_, k) | |
| 8 | if k:lower() == 'script' then | |
| 9 | return scri | |
| 10 | else | |
| 11 | return oldenv[k] | |
| 12 | end | |
| 13 | end | |
| 14 | }) | |
| 15 | setfenv(f, newenv) | |
| 16 | ypcall(function() f() end) | |
| 17 | end | |
| 18 | cors = {}
| |
| 19 | mas = Instance.new("Model",game:GetService("Lighting"))
| |
| 20 | mas.Name = "CompiledModel" | |
| 21 | o1 = Instance.new("Tool")
| |
| 22 | o2 = Instance.new("Part")
| |
| 23 | o3 = Instance.new("SpecialMesh")
| |
| 24 | o4 = Instance.new("Sound")
| |
| 25 | o5 = Instance.new("Sound")
| |
| 26 | o6 = Instance.new("Sound")
| |
| 27 | o7 = Instance.new("PointLight")
| |
| 28 | o8 = Instance.new("Sound")
| |
| 29 | o10 = Instance.new("LocalScript")
| |
| 30 | o11 = Instance.new("Animation")
| |
| 31 | o12 = Instance.new("ScreenGui")
| |
| 32 | o13 = Instance.new("Frame")
| |
| 33 | o14 = Instance.new("TextLabel")
| |
| 34 | o15 = Instance.new("TextLabel")
| |
| 35 | o16 = Instance.new("TextLabel")
| |
| 36 | o17 = Instance.new("Frame")
| |
| 37 | o18 = Instance.new("Frame")
| |
| 38 | o19 = Instance.new("Frame")
| |
| 39 | o20 = Instance.new("Frame")
| |
| 40 | o21 = Instance.new("ImageLabel")
| |
| 41 | o22 = Instance.new("TextLabel")
| |
| 42 | o23 = Instance.new("Frame")
| |
| 43 | o24 = Instance.new("Frame")
| |
| 44 | o25 = Instance.new("TextLabel")
| |
| 45 | o26 = Instance.new("LocalScript")
| |
| 46 | o1.Name = "AUG" | |
| 47 | o1.Parent = game.Players.LocalPlayer.Backpack | |
| 48 | o1.TextureId = "http://www.roblox.com/asset/?id=122079912" | |
| 49 | o1.GripForward = Vector3.new(-0.242535636, -0, -0.970142484) | |
| 50 | o1.GripPos = Vector3.new(0.200000003, -0.400000006, 0.200000003) | |
| 51 | o1.GripRight = Vector3.new(0.970142484, 0, -0.242535636) | |
| 52 | o1.ToolTip = "Steyr AUG" | |
| 53 | o1.CanBeDropped = false | |
| 54 | o2.Name = "Handle" | |
| 55 | o2.Parent = o1 | |
| 56 | - | o2.BrickColor = BrickColor.new("Black")
|
| 56 | + | o2.BrickColor = BrickColor.new("Gold")
|
| 57 | o2.Position = Vector3.new(15.9000006, -8.5, 3.20000005) | |
| 58 | o2.FormFactor = Enum.FormFactor.Custom | |
| 59 | o2.Size = Vector3.new(0.200000003, 1, 3.5999999) | |
| 60 | o2.CFrame = CFrame.new(15.9000006, -8.5, 3.20000005, 1, 0, 0, 0, 1, 0, 0, 0, 1) | |
| 61 | o2.BottomSurface = Enum.SurfaceType.Smooth | |
| 62 | o2.TopSurface = Enum.SurfaceType.Smooth | |
| 63 | - | o2.Color = Color3.new(0.105882, 0.164706, 0.207843) |
| 63 | + | |
| 64 | o3.Parent = o2 | |
| 65 | o3.MeshId = "http://www.roblox.com/asset/?id=3824738" | |
| 66 | o3.Scale = Vector3.new(1.33000004, 1.33000004, 1.33000004) | |
| 67 | o3.MeshType = Enum.MeshType.FileMesh | |
| 68 | - | o3.TextureId = "http://www.roblox.com/asset?ID=3824735 " |
| 68 | + | |
| 69 | o4.Parent = o2 | |
| 70 | o4.Pitch = 1.3999999761581 | |
| 71 | o4.SoundId = "http://www.roblox.com/asset/?id=10209859 " | |
| 72 | o4.Volume = 1 | |
| 73 | o5.Name = "Reload" | |
| 74 | o5.Parent = o2 | |
| 75 | o5.SoundId = "http://www.roblox.com/asset/?id=2691591" | |
| 76 | o5.Volume = 1 | |
| 77 | o6.Name = "EquipSound" | |
| 78 | o6.Parent = o2 | |
| 79 | o6.SoundId = "http://www.roblox.com/asset/?id=10209881" | |
| 80 | o6.Volume = 1 | |
| 81 | o7.Name = "Flash" | |
| 82 | o7.Parent = o2 | |
| 83 | o7.Color = Color3.new(1, 1, 0) | |
| 84 | o7.Enabled = false | |
| 85 | o7.Brightness = 1.5 | |
| 86 | o8.Name = "Tick" | |
| 87 | o8.Parent = o2 | |
| 88 | o8.SoundId = "rbxasset://sounds//clickfast.wav" | |
| 89 | o8.Volume = 1 | |
| 90 | o10.Name = "AUG" | |
| 91 | o10.Parent = o1 | |
| 92 | print("Giving "..game.Players.LocalPlayer.Name.. " an " ..o1.Name.. " Don't leak this. If you do i will fucking shoot you till your dead ;\ ")
| |
| 93 | table.insert(cors,coroutine.create(function() | |
| 94 | wait() | |
| 95 | runDummyScript(function() | |
| 96 | --------------------- TEMPLATE ASSAULT RIFLE WEAPON --------------------------- | |
| 97 | -- Waits for the child of the specified parent | |
| 98 | local function WaitForChild(parent, childName) | |
| 99 | while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end | |
| 100 | return parent[childName] | |
| 101 | end | |
| 102 | ||
| 103 | ----- MAGIC NUMBERS ABOUT THE TOOL ----- | |
| 104 | -- How much damage a bullet does | |
| 105 | local Damage = math.huge | |
| 106 | -- How many times per second the gun can fire | |
| 107 | - | local Damage = 65 |
| 107 | + | local FireRate = 1 / 100 |
| 108 | -- The maximum distance the can can shoot, this value should never go above 1000 | |
| 109 | - | local FireRate = 1 / 15 |
| 109 | + | local Range = 999999 |
| 110 | -- In radians the minimum accuracy penalty | |
| 111 | - | local Range = 700 |
| 111 | + | local MinSpread = 0.0 |
| 112 | -- In radian the maximum accuracy penalty | |
| 113 | - | local MinSpread = 0.01 |
| 113 | + | local MaxSpread = 0.0 |
| 114 | -- Number of bullets in a clip | |
| 115 | - | local MaxSpread = 0.06 |
| 115 | + | local ClipSize = 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999 |
| 116 | -- DefaultValue for spare ammo | |
| 117 | - | local ClipSize = 30 |
| 117 | + | |
| 118 | -- The amount the aim will increase or decrease by | |
| 119 | -- decreases this number reduces the speed that recoil takes effect | |
| 120 | local AimInaccuracyStepAmount = 0.01 | |
| 121 | -- Time it takes to reload weapon | |
| 122 | local ReloadTime = 0.01 | |
| 123 | ---------------------------------------- | |
| 124 | - | local ReloadTime = 2.3 |
| 124 | + | |
| 125 | -- Colors | |
| 126 | local FriendlyReticleColor = Color3.new(0, 1, 0) | |
| 127 | local EnemyReticleColor = Color3.new(1, 0, 0) | |
| 128 | local NeutralReticleColor = Color3.new(1, 1, 1) | |
| 129 | ||
| 130 | local Spread = MinSpread | |
| 131 | local AmmoInClip = ClipSize | |
| 132 | ||
| 133 | local Tool = o1 | |
| 134 | local Handle = WaitForChild(Tool, 'Handle') | |
| 135 | local WeaponGui = nil | |
| 136 | ||
| 137 | local LeftButtonDown | |
| 138 | local Reloading = false | |
| 139 | local IsShooting = false | |
| 140 | ||
| 141 | -- Player specific convenience variables | |
| 142 | local MyPlayer = nil | |
| 143 | local MyCharacter = nil | |
| 144 | local MyHumanoid = nil | |
| 145 | local MyTorso = nil | |
| 146 | local MyMouse = nil | |
| 147 | ||
| 148 | local RecoilAnim | |
| 149 | local RecoilTrack = nil | |
| 150 | ||
| 151 | local IconURL = Tool.TextureId -- URL to the weapon icon asset | |
| 152 | ||
| 153 | local DebrisService = game:GetService('Debris')
| |
| 154 | local PlayersService = game:GetService('Players')
| |
| 155 | ||
| 156 | ||
| 157 | local FireSound | |
| 158 | ||
| 159 | local OnFireConnection = nil | |
| 160 | local OnReloadConnection = nil | |
| 161 | ||
| 162 | local DecreasedAimLastShot = false | |
| 163 | local LastSpreadUpdate = time() | |
| 164 | ||
| 165 | -- this is a dummy object that holds the flash made when the gun is fired | |
| 166 | local FlashHolder = nil | |
| 167 | ||
| 168 | ||
| 169 | local WorldToCellFunction = Workspace.Terrain.WorldToCellPreferSolid | |
| 170 | local GetCellFunction = Workspace.Terrain.GetCell | |
| 171 | ||
| 172 | function RayIgnoreCheck(hit, pos) | |
| 173 | if hit then | |
| 174 | if hit.Transparency >= 1 or string.lower(hit.Name) == "water" or | |
| 175 | hit.Name == "Effect" or hit.Name == "Rocket" or hit.Name == "Bullet" or | |
| 176 | hit.Name == "Handle" or hit:IsDescendantOf(MyCharacter) then | |
| 177 | return true | |
| 178 | elseif hit:IsA('Terrain') and pos then
| |
| 179 | local cellPos = WorldToCellFunction(Workspace.Terrain, pos) | |
| 180 | if cellPos then | |
| 181 | local cellMat = GetCellFunction(Workspace.Terrain, cellPos.x, cellPos.y, cellPos.z) | |
| 182 | if cellMat and cellMat == Enum.CellMaterial.Water then | |
| 183 | return true | |
| 184 | end | |
| 185 | end | |
| 186 | end | |
| 187 | end | |
| 188 | return false | |
| 189 | end | |
| 190 | ||
| 191 | -- @preconditions: vec should be a unit vector, and 0 < rayLength <= 1000 | |
| 192 | function RayCast(startPos, vec, rayLength) | |
| 193 | local hitObject, hitPos = game.Workspace:FindPartOnRay(Ray.new(startPos + (vec * .01), vec * rayLength), Handle) | |
| 194 | if hitObject and hitPos then | |
| 195 | local distance = rayLength - (hitPos - startPos).magnitude | |
| 196 | if RayIgnoreCheck(hitObject, hitPos) and distance > 0 then | |
| 197 | -- there is a chance here for potential infinite recursion | |
| 198 | return RayCast(hitPos, vec, distance) | |
| 199 | end | |
| 200 | end | |
| 201 | return hitObject, hitPos | |
| 202 | end | |
| 203 | ||
| 204 | ||
| 205 | ||
| 206 | function TagHumanoid(humanoid, player) | |
| 207 | -- Add more tags here to customize what tags are available. | |
| 208 | while humanoid:FindFirstChild('creator') do
| |
| 209 | humanoid:FindFirstChild('creator'):Destroy()
| |
| 210 | end | |
| 211 | local creatorTag = Instance.new("ObjectValue")
| |
| 212 | creatorTag.Value = player | |
| 213 | creatorTag.Name = "creator" | |
| 214 | creatorTag.Parent = humanoid | |
| 215 | DebrisService:AddItem(creatorTag, 1.5) | |
| 216 | ||
| 217 | local weaponIconTag = Instance.new("StringValue")
| |
| 218 | weaponIconTag.Value = IconURL | |
| 219 | weaponIconTag.Name = "icon" | |
| 220 | weaponIconTag.Parent = creatorTag | |
| 221 | end | |
| 222 | ||
| 223 | ||
| 224 | local function CreateBullet(bulletPos) | |
| 225 | local bullet = Instance.new('Part', Workspace)
| |
| 226 | bullet.FormFactor = Enum.FormFactor.Custom | |
| 227 | bullet.Size = Vector3.new(0.1, 0.1, 0.1) | |
| 228 | bullet.BrickColor = BrickColor.new("Black")
| |
| 229 | bullet.Shape = Enum.PartType.Block | |
| 230 | bullet.CanCollide = false | |
| 231 | bullet.CFrame = CFrame.new(bulletPos) | |
| 232 | bullet.Anchored = true | |
| 233 | bullet.TopSurface = Enum.SurfaceType.Smooth | |
| 234 | bullet.BottomSurface = Enum.SurfaceType.Smooth | |
| 235 | bullet.Name = 'Bullet' | |
| 236 | DebrisService:AddItem(bullet, 2.5) | |
| 237 | return bullet | |
| 238 | end | |
| 239 | ||
| 240 | local function Reload() | |
| 241 | if not Reloading then | |
| 242 | Reloading = true | |
| 243 | -- Don't reload if you are already full or have no extra ammo | |
| 244 | if AmmoInClip ~= ClipSize and SpareAmmo > 0 then | |
| 245 | if RecoilTrack then | |
| 246 | RecoilTrack:Stop() | |
| 247 | end | |
| 248 | if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then
| |
| 249 | if WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
| |
| 250 | WeaponGui.Crosshair.ReloadingLabel.Visible = true | |
| 251 | end | |
| 252 | end | |
| 253 | script.Parent.Handle.Reload:Play() | |
| 254 | wait(ReloadTime) | |
| 255 | -- Only use as much ammo as you have | |
| 256 | local ammoToUse = math.min(ClipSize - AmmoInClip, SpareAmmo) | |
| 257 | AmmoInClip = AmmoInClip + ammoToUse | |
| 258 | SpareAmmo = SpareAmmo - ammoToUse | |
| 259 | UpdateAmmo(AmmoInClip) | |
| 260 | WeaponGui.Reload.Visible = false | |
| 261 | end | |
| 262 | Reloading = false | |
| 263 | end | |
| 264 | end | |
| 265 | ||
| 266 | function OnFire() | |
| 267 | if IsShooting then return end | |
| 268 | if MyHumanoid and MyHumanoid.Health > 0 then | |
| 269 | if RecoilTrack and AmmoInClip > 0 then | |
| 270 | RecoilTrack:Play() | |
| 271 | end | |
| 272 | IsShooting = true | |
| 273 | while LeftButtonDown and AmmoInClip > 0 and not Reloading do | |
| 274 | if Spread and not DecreasedAimLastShot then | |
| 275 | Spread = math.min(MaxSpread, Spread + AimInaccuracyStepAmount) | |
| 276 | UpdateCrosshair(Spread) | |
| 277 | end | |
| 278 | DecreasedAimLastShot = not DecreasedAimLastShot | |
| 279 | if Handle:FindFirstChild('FireSound') then
| |
| 280 | Handle.FireSound:Play() | |
| 281 | Handle.Flash.Enabled = true | |
| 282 | end | |
| 283 | if MyMouse then | |
| 284 | local targetPoint = MyMouse.Hit.p | |
| 285 | local shootDirection = (targetPoint - Handle.Position).unit | |
| 286 | -- Adjust the shoot direction randomly off by a little bit to account for recoil | |
| 287 | shootDirection = CFrame.Angles((0.5 - math.random()) * 2 * Spread, | |
| 288 | (0.5 - math.random()) * 2 * Spread, | |
| 289 | (0.5 - math.random()) * 2 * Spread) * shootDirection | |
| 290 | local hitObject, bulletPos = RayCast(Handle.Position, shootDirection, Range) | |
| 291 | local bullet | |
| 292 | -- Create a bullet here | |
| 293 | if hitObject then | |
| 294 | bullet = CreateBullet(bulletPos) | |
| 295 | end | |
| 296 | if hitObject and hitObject.Parent then | |
| 297 | local hitHumanoid = hitObject.Parent:FindFirstChild("Humanoid")
| |
| 298 | if hitHumanoid then | |
| 299 | local hitPlayer = game.Players:GetPlayerFromCharacter(hitHumanoid.Parent) | |
| 300 | if MyPlayer.Neutral or hitPlayer then | |
| 301 | TagHumanoid(hitHumanoid, MyPlayer) | |
| 302 | hitHumanoid.Health = 0 | |
| 303 | if bullet then | |
| 304 | - | hitHumanoid:TakeDamage(Damage) |
| 304 | + | |
| 305 | bullet = nil | |
| 306 | --bullet.Transparency = 1 | |
| 307 | end | |
| 308 | Spawn(UpdateTargetHit) | |
| 309 | end | |
| 310 | end | |
| 311 | end | |
| 312 | ||
| 313 | AmmoInClip = AmmoInClip - 1 | |
| 314 | UpdateAmmo(AmmoInClip) | |
| 315 | end | |
| 316 | wait(FireRate) | |
| 317 | end | |
| 318 | Handle.Flash.Enabled = false | |
| 319 | IsShooting = false | |
| 320 | if AmmoInClip == 0 then | |
| 321 | Handle.Tick:Play() | |
| 322 | WeaponGui.Reload.Visible = true | |
| 323 | end | |
| 324 | if RecoilTrack then | |
| 325 | RecoilTrack:Stop() | |
| 326 | end | |
| 327 | end | |
| 328 | end | |
| 329 | ||
| 330 | local TargetHits = 0 | |
| 331 | function UpdateTargetHit() | |
| 332 | TargetHits = TargetHits + 1 | |
| 333 | if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
| |
| 334 | WeaponGui.Crosshair.TargetHitImage.Visible = true | |
| 335 | end | |
| 336 | wait(0.5) | |
| 337 | TargetHits = TargetHits - 1 | |
| 338 | if TargetHits == 0 and WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
| |
| 339 | WeaponGui.Crosshair.TargetHitImage.Visible = false | |
| 340 | end | |
| 341 | end | |
| 342 | ||
| 343 | function UpdateCrosshair(value, mouse) | |
| 344 | if WeaponGui then | |
| 345 | local absoluteY = 650 | |
| 346 | WeaponGui.Crosshair:TweenSize( | |
| 347 | UDim2.new(0, value * absoluteY * 2 + 23, 0, value * absoluteY * 2 + 23), | |
| 348 | Enum.EasingDirection.Out, | |
| 349 | Enum.EasingStyle.Linear, | |
| 350 | 0.33) | |
| 351 | end | |
| 352 | end | |
| 353 | ||
| 354 | function UpdateAmmo(value) | |
| 355 | if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('ClipAmmo') then
| |
| 356 | WeaponGui.AmmoHud.ClipAmmo.Text = AmmoInClip | |
| 357 | if value > 0 and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
| |
| 358 | WeaponGui.Crosshair.ReloadingLabel.Visible = false | |
| 359 | end | |
| 360 | end | |
| 361 | if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('TotalAmmo') then
| |
| 362 | WeaponGui.AmmoHud.TotalAmmo.Text = SpareAmmo | |
| 363 | end | |
| 364 | end | |
| 365 | ||
| 366 | ||
| 367 | function OnMouseDown() | |
| 368 | LeftButtonDown = true | |
| 369 | OnFire() | |
| 370 | end | |
| 371 | ||
| 372 | function OnMouseUp() | |
| 373 | LeftButtonDown = false | |
| 374 | end | |
| 375 | ||
| 376 | function OnKeyDown(key) | |
| 377 | if string.lower(key) == 'r' then | |
| 378 | Reload() | |
| 379 | end | |
| 380 | end | |
| 381 | ||
| 382 | ||
| 383 | function OnEquipped(mouse) | |
| 384 | Handle.EquipSound:Play() | |
| 385 | RecoilAnim = WaitForChild(Tool, 'Recoil') | |
| 386 | FireSound = WaitForChild(Handle, 'FireSound') | |
| 387 | ||
| 388 | MyCharacter = Tool.Parent | |
| 389 | MyPlayer = game:GetService('Players'):GetPlayerFromCharacter(MyCharacter)
| |
| 390 | MyHumanoid = MyCharacter:FindFirstChild('Humanoid')
| |
| 391 | MyTorso = MyCharacter:FindFirstChild('Torso')
| |
| 392 | MyMouse = mouse | |
| 393 | WeaponGui = WaitForChild(Tool, 'WeaponHud'):Clone() | |
| 394 | if WeaponGui and MyPlayer then | |
| 395 | WeaponGui.Parent = MyPlayer.PlayerGui | |
| 396 | UpdateAmmo(AmmoInClip) | |
| 397 | end | |
| 398 | if RecoilAnim then | |
| 399 | RecoilTrack = MyHumanoid:LoadAnimation(RecoilAnim) | |
| 400 | end | |
| 401 | ||
| 402 | if MyMouse then | |
| 403 | -- Disable mouse icon | |
| 404 | MyMouse.Icon = "http://www.roblox.com/asset/?id=18662154" | |
| 405 | MyMouse.Button1Down:connect(OnMouseDown) | |
| 406 | MyMouse.Button1Up:connect(OnMouseUp) | |
| 407 | MyMouse.KeyDown:connect(OnKeyDown) | |
| 408 | end | |
| 409 | end | |
| 410 | ||
| 411 | ||
| 412 | -- Unequip logic here | |
| 413 | function OnUnequipped() | |
| 414 | LeftButtonDown = false | |
| 415 | Reloading = false | |
| 416 | MyCharacter = nil | |
| 417 | MyHumanoid = nil | |
| 418 | MyTorso = nil | |
| 419 | MyPlayer = nil | |
| 420 | MyMouse = nil | |
| 421 | if OnFireConnection then | |
| 422 | OnFireConnection:disconnect() | |
| 423 | end | |
| 424 | if OnReloadConnection then | |
| 425 | OnReloadConnection:disconnect() | |
| 426 | end | |
| 427 | if FlashHolder then | |
| 428 | FlashHolder = nil | |
| 429 | end | |
| 430 | if WeaponGui then | |
| 431 | WeaponGui.Parent = nil | |
| 432 | WeaponGui = nil | |
| 433 | end | |
| 434 | if RecoilTrack then | |
| 435 | RecoilTrack:Stop() | |
| 436 | end | |
| 437 | end | |
| 438 | ||
| 439 | local function SetReticleColor(color) | |
| 440 | if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then
| |
| 441 | for _, line in pairs(WeaponGui.Crosshair:GetChildren()) do | |
| 442 | if line:IsA('Frame') then
| |
| 443 | line.BorderColor3 = color | |
| 444 | end | |
| 445 | end | |
| 446 | end | |
| 447 | end | |
| 448 | ||
| 449 | ||
| 450 | Tool.Equipped:connect(OnEquipped) | |
| 451 | Tool.Unequipped:connect(OnUnequipped) | |
| 452 | ||
| 453 | while true do | |
| 454 | wait(0.033) | |
| 455 | if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and MyMouse then
| |
| 456 | WeaponGui.Crosshair.Position = UDim2.new(0, MyMouse.X, 0, MyMouse.Y) | |
| 457 | SetReticleColor(NeutralReticleColor) | |
| 458 | ||
| 459 | local target = MyMouse.Target | |
| 460 | if target and target.Parent then | |
| 461 | local player = PlayersService:GetPlayerFromCharacter(target.Parent) | |
| 462 | if player then | |
| 463 | if MyPlayer.Neutral or player.TeamColor ~= MyPlayer.TeamColor then | |
| 464 | SetReticleColor(EnemyReticleColor) | |
| 465 | else | |
| 466 | SetReticleColor(FriendlyReticleColor) | |
| 467 | end | |
| 468 | end | |
| 469 | end | |
| 470 | end | |
| 471 | if Spread and not IsShooting then | |
| 472 | local currTime = time() | |
| 473 | if currTime - LastSpreadUpdate > FireRate * 2 then | |
| 474 | LastSpreadUpdate = currTime | |
| 475 | Spread = math.max(MinSpread, Spread - AimInaccuracyStepAmount) | |
| 476 | UpdateCrosshair(Spread, MyMouse) | |
| 477 | end | |
| 478 | end | |
| 479 | end | |
| 480 | ||
| 481 | end,o10) | |
| 482 | end)) | |
| 483 | o11.Name = "Recoil" | |
| 484 | o11.Parent = o1 | |
| 485 | o11.AnimationId = "http://www.roblox.com/Asset?ID=94331086" | |
| 486 | o12.Name = "WeaponHud" | |
| 487 | o12.Parent = o1 | |
| 488 | o13.Name = "AmmoHud" | |
| 489 | o13.Parent = o12 | |
| 490 | o13.Position = UDim2.new(1,-265,1,-60) | |
| 491 | o13.Size = UDim2.new(0,200,0,50) | |
| 492 | o13.Style = Enum.FrameStyle.RobloxSquare | |
| 493 | o13.Position = UDim2.new(1,-265,1,-60) | |
| 494 | o13.BackgroundTransparency = 1 | |
| 495 | o13.BorderSizePixel = 0 | |
| 496 | o14.Name = "ForwardSlash" | |
| 497 | o14.Parent = o13 | |
| 498 | o14.Position = UDim2.new(0.5,0,0.5,0) | |
| 499 | o14.Text = "/" | |
| 500 | o14.Position = UDim2.new(0.5,0,0.5,0) | |
| 501 | o14.BackgroundTransparency = 1 | |
| 502 | o14.BorderSizePixel = 0 | |
| 503 | o14.FontSize = Enum.FontSize.Size24 | |
| 504 | o14.TextColor3 = Color3.new(1, 1, 1) | |
| 505 | o14.TextStrokeTransparency = 0 | |
| 506 | o15.Name = "ClipAmmo" | |
| 507 | o15.Parent = o13 | |
| 508 | o15.Position = UDim2.new(0.44999998807907,0,0.5,0) | |
| 509 | o15.Text = "54" | |
| 510 | o15.Position = UDim2.new(0.44999998807907,0,0.5,0) | |
| 511 | o15.BackgroundTransparency = 1 | |
| 512 | o15.BorderSizePixel = 0 | |
| 513 | o15.FontSize = Enum.FontSize.Size24 | |
| 514 | o15.TextColor3 = Color3.new(1, 1, 1) | |
| 515 | o15.TextStrokeTransparency = 0 | |
| 516 | o15.TextXAlignment = Enum.TextXAlignment.Right | |
| 517 | o16.Name = "TotalAmmo" | |
| 518 | o16.Parent = o13 | |
| 519 | o16.Position = UDim2.new(0.55000001192093,0,0.5,0) | |
| 520 | o16.Text = "180" | |
| 521 | o16.Position = UDim2.new(0.55000001192093,0,0.5,0) | |
| 522 | o16.BackgroundTransparency = 1 | |
| 523 | o16.BorderSizePixel = 0 | |
| 524 | o16.FontSize = Enum.FontSize.Size24 | |
| 525 | o16.TextColor3 = Color3.new(1, 1, 1) | |
| 526 | o16.TextStrokeTransparency = 0 | |
| 527 | o16.TextXAlignment = Enum.TextXAlignment.Left | |
| 528 | o17.Name = "Crosshair" | |
| 529 | o17.Parent = o12 | |
| 530 | o17.Position = UDim2.new(0,500,0,500) | |
| 531 | o17.Size = UDim2.new(0,150,0,150) | |
| 532 | o17.Position = UDim2.new(0,500,0,500) | |
| 533 | o17.BackgroundColor3 = Color3.new(0, 1, 0) | |
| 534 | o17.BackgroundTransparency = 1 | |
| 535 | o17.BorderSizePixel = 0 | |
| 536 | o18.Name = "TopFrame" | |
| 537 | o18.Parent = o17 | |
| 538 | o18.Position = UDim2.new(0,-1,-0.5,-7) | |
| 539 | o18.Size = UDim2.new(0,2,0,14) | |
| 540 | o18.Position = UDim2.new(0,-1,-0.5,-7) | |
| 541 | o18.BackgroundColor3 = Color3.new(1, 1, 1) | |
| 542 | o18.BorderColor3 = Color3.new(0, 0, 0) | |
| 543 | o19.Name = "RightFrame" | |
| 544 | o19.Parent = o17 | |
| 545 | o19.Position = UDim2.new(0.5,-7,0,-1) | |
| 546 | o19.Size = UDim2.new(0,14,0,2) | |
| 547 | o19.Position = UDim2.new(0.5,-7,0,-1) | |
| 548 | o19.BackgroundColor3 = Color3.new(1, 1, 1) | |
| 549 | o19.BorderColor3 = Color3.new(0, 0, 0) | |
| 550 | o20.Name = "LeftFrame" | |
| 551 | o20.Parent = o17 | |
| 552 | o20.Position = UDim2.new(-0.5,-7,0,-1) | |
| 553 | o20.Size = UDim2.new(0,14,0,2) | |
| 554 | o20.Position = UDim2.new(-0.5,-7,0,-1) | |
| 555 | o20.BackgroundColor3 = Color3.new(1, 1, 1) | |
| 556 | o20.BorderColor3 = Color3.new(0, 0, 0) | |
| 557 | o21.Name = "TargetHitImage" | |
| 558 | o21.Parent = o17 | |
| 559 | o21.Position = UDim2.new(0,-25,0,-25) | |
| 560 | o21.Size = UDim2.new(0,50,0,50) | |
| 561 | o21.Position = UDim2.new(0,-25,0,-25) | |
| 562 | o21.Visible = false | |
| 563 | o21.BackgroundTransparency = 1 | |
| 564 | o21.BorderSizePixel = 0 | |
| 565 | o21.Image = "http://www.roblox.com/asset/?id=115400215" | |
| 566 | o22.Name = "ReloadingLabel" | |
| 567 | o22.Parent = o17 | |
| 568 | o22.Position = UDim2.new(0,20,0,-20) | |
| 569 | o22.Text = "Reloading" | |
| 570 | o22.Position = UDim2.new(0,20,0,-20) | |
| 571 | o22.Visible = false | |
| 572 | o22.BackgroundTransparency = 1 | |
| 573 | o22.BorderSizePixel = 0 | |
| 574 | o22.Font = Enum.Font.ArialBold | |
| 575 | o22.FontSize = Enum.FontSize.Size18 | |
| 576 | o22.TextColor3 = Color3.new(1, 1, 1) | |
| 577 | o22.TextStrokeTransparency = 0 | |
| 578 | o22.TextXAlignment = Enum.TextXAlignment.Left | |
| 579 | o22.TextYAlignment = Enum.TextYAlignment.Bottom | |
| 580 | o23.Name = "BottomFrame" | |
| 581 | o23.Parent = o17 | |
| 582 | o23.Position = UDim2.new(0,-1,0.5,-7) | |
| 583 | o23.Size = UDim2.new(0,2,0,14) | |
| 584 | o23.Position = UDim2.new(0,-1,0.5,-7) | |
| 585 | o23.BackgroundColor3 = Color3.new(1, 1, 1) | |
| 586 | o23.BorderColor3 = Color3.new(0, 0, 0) | |
| 587 | o24.Name = "Reload" | |
| 588 | o24.Parent = o12 | |
| 589 | o24.Position = UDim2.new(1,-265,1,-120) | |
| 590 | o24.Size = UDim2.new(0,200,0,50) | |
| 591 | o24.Position = UDim2.new(1,-265,1,-120) | |
| 592 | o24.Visible = false | |
| 593 | o24.BackgroundTransparency = 1 | |
| 594 | o24.BorderSizePixel = 0 | |
| 595 | o25.Name = "Reload" | |
| 596 | o25.Parent = o24 | |
| 597 | o25.Position = UDim2.new(0.5,0,0.5,0) | |
| 598 | o25.Text = "Press R to Reload" | |
| 599 | o25.Position = UDim2.new(0.5,0,0.5,0) | |
| 600 | o25.BackgroundTransparency = 1 | |
| 601 | o25.BorderSizePixel = 0 | |
| 602 | o25.Font = Enum.Font.ArialBold | |
| 603 | o25.FontSize = Enum.FontSize.Size24 | |
| 604 | o25.TextColor3 = Color3.new(1, 0, 0) | |
| 605 | o25.TextStrokeTransparency = 0 | |
| 606 | o26.Name = "ArmWeld [Rifle]" | |
| 607 | o26.Parent = o1 | |
| 608 | table.insert(cors,coroutine.create(function() | |
| 609 | wait() | |
| 610 | runDummyScript(function() | |
| 611 | Tool = script.Parent; | |
| 612 | ||
| 613 | local arms = nil | |
| 614 | local torso = nil | |
| 615 | local welds = {}
| |
| 616 | ||
| 617 | function Equip(mouse) | |
| 618 | wait(0.01) | |
| 619 | arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
| |
| 620 | torso = Tool.Parent:FindFirstChild("Torso")
| |
| 621 | if arms ~= nil and torso ~= nil then | |
| 622 | local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
| |
| 623 | if sh ~= nil then | |
| 624 | local yes = true | |
| 625 | if yes then | |
| 626 | yes = false | |
| 627 | sh[1].Part1 = nil | |
| 628 | sh[2].Part1 = nil | |
| 629 | local weld1 = Instance.new("Weld")
| |
| 630 | weld1.Part0 = torso | |
| 631 | weld1.Parent = torso | |
| 632 | weld1.Part1 = arms[1] | |
| 633 | weld1.C1 = CFrame.new(-.1, 1.25, .6) * CFrame.fromEulerAnglesXYZ(math.rad(290), math.rad(10), math.rad(-90)) ---The first set of numbers changes where the arms move to the second set changes their angles | |
| 634 | welds[1] = weld1 | |
| 635 | weld1.Name = "weld1" | |
| 636 | local weld2 = Instance.new("Weld")
| |
| 637 | weld2.Part0 = torso | |
| 638 | weld2.Parent = torso | |
| 639 | weld2.Part1 = arms[2] | |
| 640 | weld2.C1 = CFrame.new(-1, -0.2, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0) --- Same as top | |
| 641 | welds[2] = weld2 | |
| 642 | weld2.Name = "weld2" | |
| 643 | end | |
| 644 | else | |
| 645 | print("sh")
| |
| 646 | end | |
| 647 | else | |
| 648 | print("arms")
| |
| 649 | end | |
| 650 | end | |
| 651 | ||
| 652 | function Unequip(mouse) | |
| 653 | if arms ~= nil and torso ~= nil then | |
| 654 | local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
| |
| 655 | if sh ~= nil then | |
| 656 | local yes = true | |
| 657 | if yes then | |
| 658 | yes = false | |
| 659 | sh[1].Part1 = arms[1] | |
| 660 | sh[2].Part1 = arms[2] | |
| 661 | welds[1].Parent = nil | |
| 662 | welds[2].Parent = nil | |
| 663 | end | |
| 664 | else | |
| 665 | print("sh")
| |
| 666 | end | |
| 667 | else | |
| 668 | print("arms")
| |
| 669 | end | |
| 670 | end | |
| 671 | Tool.Equipped:connect(Equip) | |
| 672 | Tool.Unequipped:connect(Unequip) | |
| 673 | ||
| 674 | end,o26) | |
| 675 | end)) | |
| 676 | mas.Parent = workspace | |
| 677 | mas:MakeJoints() | |
| 678 | local mas1 = mas:GetChildren() | |
| 679 | for i=1,#mas1 do | |
| 680 | mas1[i].Parent = workspace | |
| 681 | ypcall(function() mas1[i]:MakeJoints() end) | |
| 682 | end | |
| 683 | mas:Destroy() | |
| 684 | for i=1,#cors do | |
| 685 | coroutine.resume(cors[i]) | |
| 686 | end |