SHOW:
|
|
- or go back to the newest paste.
| 1 | -- This script has been converted to FE by iPxter | |
| 2 | ||
| 3 | ||
| 4 | if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
| |
| 5 | local Player,Mouse,mouse,UserInputService,ContextActionService = owner | |
| 6 | do | |
| 7 | print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
| |
| 8 | script.Parent = Player.Character | |
| 9 | ||
| 10 | --RemoteEvent for communicating | |
| 11 | local Event = Instance.new("RemoteEvent")
| |
| 12 | Event.Name = "UserInput_Event" | |
| 13 | ||
| 14 | --Fake event to make stuff like Mouse.KeyDown work | |
| 15 | local function fakeEvent() | |
| 16 | local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
| |
| 17 | t.connect = t.Connect | |
| 18 | return t | |
| 19 | end | |
| 20 | ||
| 21 | --Creating fake input objects with fake variables | |
| 22 | local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
| |
| 23 | local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
| |
| 24 | local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
| |
| 25 | CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
| |
| 26 | end} | |
| 27 | --Merged 2 functions into one by checking amount of arguments | |
| 28 | CAS.UnbindAction = CAS.BindAction | |
| 29 | ||
| 30 | --This function will trigger the events that have been :Connect()'ed | |
| 31 | local function te(self,ev,...) | |
| 32 | local t = m[ev] | |
| 33 | if t and t._fakeEvent and t.Function then | |
| 34 | t.Function(...) | |
| 35 | end | |
| 36 | end | |
| 37 | m.TrigEvent = te | |
| 38 | UIS.TrigEvent = te | |
| 39 | ||
| 40 | Event.OnServerEvent:Connect(function(plr,io) | |
| 41 | if plr~=Player then return end | |
| 42 | if io.isMouse then | |
| 43 | m.Target = io.Target | |
| 44 | m.Hit = io.Hit | |
| 45 | else | |
| 46 | local b = io.UserInputState == Enum.UserInputState.Begin | |
| 47 | if io.UserInputType == Enum.UserInputType.MouseButton1 then | |
| 48 | return m:TrigEvent(b and "Button1Down" or "Button1Up") | |
| 49 | end | |
| 50 | for _,t in pairs(CAS.Actions) do | |
| 51 | for _,k in pairs(t.Keys) do | |
| 52 | if k==io.KeyCode then | |
| 53 | t.Function(t.Name,io.UserInputState,io) | |
| 54 | end | |
| 55 | end | |
| 56 | end | |
| 57 | m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower()) | |
| 58 | UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false) | |
| 59 | end | |
| 60 | end) | |
| 61 | Event.Parent = NLS([==[ | |
| 62 | local Player = game:GetService("Players").LocalPlayer
| |
| 63 | local Event = script:WaitForChild("UserInput_Event")
| |
| 64 | ||
| 65 | local UIS = game:GetService("UserInputService")
| |
| 66 | local input = function(io,a) | |
| 67 | if a then return end | |
| 68 | --Since InputObject is a client-side instance, we create and pass table instead | |
| 69 | Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
| |
| 70 | end | |
| 71 | UIS.InputBegan:Connect(input) | |
| 72 | UIS.InputEnded:Connect(input) | |
| 73 | ||
| 74 | local Mouse = Player:GetMouse() | |
| 75 | local h,t | |
| 76 | --Give the server mouse data 30 times every second, but only if the values changed | |
| 77 | --If player is not moving their mouse, client won't fire events | |
| 78 | while wait(1/30) do | |
| 79 | if h~=Mouse.Hit or t~=Mouse.Target then | |
| 80 | h,t=Mouse.Hit,Mouse.Target | |
| 81 | Event:FireServer({isMouse=true,Target=t,Hit=h})
| |
| 82 | end | |
| 83 | end]==],Player.Character) | |
| 84 | Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS | |
| 85 | end | |
| 86 | ||
| 87 | Character = owner | |
| 88 | Player = owner | |
| 89 | char = Character | |
| 90 | hum = Character.Humanoid | |
| 91 | Torso = Character.Torso | |
| 92 | Head = Character.Head | |
| 93 | ||
| 94 | hum.MaxHealth = math.huge | |
| 95 | end | |
| 96 | ||
| 97 | --141378828 | |
| 98 | Reaper = Instance.new("Model")
| |
| 99 | Reaper.Parent = Player.Character | |
| 100 | Reaper.Name = "Reaper" | |
| 101 | rh = Instance.new("Part")
| |
| 102 | rh.Parent = Reaper | |
| 103 | rh.BrickColor = BrickColor.new("Really red")
| |
| 104 | rh.Locked = true | |
| 105 | rh.CanCollide = false | |
| 106 | mesh = Instance.new("SpecialMesh")
| |
| 107 | rh.formFactor = "Symmetric" | |
| 108 | mesh.MeshType = "FileMesh" | |
| 109 | mesh.MeshId = "http://www.roblox.com/asset/?id=9" | |
| 110 | mesh.TextureId = "http://www.roblox.com/asset/?id=9" | |
| 111 | mesh.Parent = rh | |
| 112 | mesh.Scale = Vector3.new(1.1,1.1,1.1) | |
| 113 | local weld = Instance.new("Weld")
| |
| 114 | weld.Parent = rh | |
| 115 | rh.Transparency = 0 | |
| 116 | weld.Part0 = rh | |
| 117 | weld.Part1 = Player.Character.Head | |
| 118 | weld.C0 = CFrame.new(-0, 0.7, -0)*CFrame.Angles(0, 0, 0) | |
| 119 | ||
| 120 | local s = Instance.new("Sound",char)
| |
| 121 | s.SoundId = "http://www.roblox.com/asset/?id=933032912" | |
| 122 | s.Pitch = 1 | |
| 123 | s.Volume = 9999 | |
| 124 | s.Looped = true | |
| 125 | wait(1) | |
| 126 | s:play() | |
| 127 | local txtfag = owner | |
| 128 | txtfag.Adornee = suckadick | |
| 129 | txtfag.Name = "kys nigga" | |
| 130 | txtfag.Size = UDim2.new(2, 0, 1.2, 0) | |
| 131 | txtfag.StudsOffset = Vector3.new(-5, 3, 0) | |
| 132 | local textfag = Instance.new("TextLabel", txtfag)
| |
| 133 | textfag.Size = UDim2.new(6, 0, 1, 0) | |
| 134 | textfag.FontSize = "Size8" | |
| 135 | textfag.TextScaled = true | |
| 136 | textfag.TextTransparency = 0 | |
| 137 | textfag.BackgroundTransparency = 1 | |
| 138 | textfag.TextTransparency = 0 | |
| 139 | textfag.TextStrokeTransparency = 0 | |
| 140 | textfag.Font = "Code" | |
| 141 | textfag.TextStrokeColor3 = Color3.new(0, 255, 0) | |
| 142 | v = Instance.new("Part")
| |
| 143 | v.Name = "ColorBrick" | |
| 144 | v.Parent = part | |
| 145 | v.FormFactor = "Symmetric" | |
| 146 | v.Anchored = true | |
| 147 | v.CanCollide = false | |
| 148 | v.BottomSurface = "Smooth" | |
| 149 | v.TopSurface = "Smooth" | |
| 150 | v.Size = Vector3.new(10, 5, 3) | |
| 151 | v.Transparency = 0.7 | |
| 152 | v.BrickColor = owner | |
| 153 | v.Transparency = 1 | |
| 154 | textfag.TextColor3 = v.BrickColor.Color | |
| 155 | v.Shape = "Block" | |
| 156 | textfag.TextStrokeColor3 = Color3.new(0, 255, 0) | |
| 157 | textfag.Text = "Eu..." | |
| 158 | wait(2) | |
| 159 | textfag.Text = "Eu... Sou... Douglas..." | |
| 160 | wait(2) | |
| 161 | textfag.Text = "Como vc nao gosta de pao?" | |
| 162 | wait(2) | |
| 163 | textfag.Text = "Quem nao gosta de pao merece morrer." | |
| 164 | wait(2) | |
| 165 | textfag.Text = "E entao, vc vai morrer agr, por mim, pois vc n gosta de pao." | |
| 166 | wait(2) | |
| 167 | textfag.Text = "" | |
| 168 | ||
| 169 | local runDummyScript = function(f,scri) | |
| 170 | local oldenv = getfenv(f) | |
| 171 | local newenv = setmetatable({}, {
| |
| 172 | __index = function(_, k) | |
| 173 | if k:lower() == 'script' then | |
| 174 | return scri | |
| 175 | else | |
| 176 | return oldenv[k] | |
| 177 | end | |
| 178 | end | |
| 179 | }) | |
| 180 | setfenv(f, newenv) | |
| 181 | ypcall(function() f() end) | |
| 182 | end | |
| 183 | cors = {}
| |
| 184 | mas = Instance.new("Model",game:GetService("Lighting"))
| |
| 185 | mas.Name = "CompiledModel" | |
| 186 | o1 = Instance.new("Tool")
| |
| 187 | o2 = Instance.new("Part")
| |
| 188 | o3 = Instance.new("SpecialMesh")
| |
| 189 | o4 = Instance.new("Sound")
| |
| 190 | o5 = Instance.new("Sound")
| |
| 191 | o6 = Instance.new("Sound")
| |
| 192 | o7 = Instance.new("PointLight")
| |
| 193 | o8 = Instance.new("Sound")
| |
| 194 | o10 = Instance.new("LocalScript")
| |
| 195 | o11 = Instance.new("Animation")
| |
| 196 | o12 = Instance.new("ScreenGui")
| |
| 197 | o13 = Instance.new("Frame")
| |
| 198 | o14 = Instance.new("TextLabel")
| |
| 199 | o15 = Instance.new("TextLabel")
| |
| 200 | o16 = Instance.new("TextLabel")
| |
| 201 | o17 = Instance.new("Frame")
| |
| 202 | o18 = Instance.new("Frame")
| |
| 203 | o19 = Instance.new("Frame")
| |
| 204 | o20 = Instance.new("Frame")
| |
| 205 | o21 = Instance.new("ImageLabel")
| |
| 206 | o22 = Instance.new("TextLabel")
| |
| 207 | o23 = Instance.new("Frame")
| |
| 208 | o24 = Instance.new("Frame")
| |
| 209 | o25 = Instance.new("TextLabel")
| |
| 210 | o26 = Instance.new("LocalScript")
| |
| 211 | o1.Name = "AUG" | |
| 212 | o1.Parent = owner | |
| 213 | o1.TextureId = "http://www.roblox.com/asset/?id=470208943" | |
| 214 | o1.GripForward = Vector3.new(-0.242535636, -0, -0.970142484) | |
| 215 | o1.GripPos = Vector3.new(0.200000003, -0.400000006, 0.200000003) | |
| 216 | o1.GripRight = Vector3.new(0.970142484, 0, -0.242535636) | |
| 217 | o1.ToolTip = "Steyr AUG" | |
| 218 | o1.CanBeDropped = false | |
| 219 | o2.Name = "Handle" | |
| 220 | o2.Parent = o1 | |
| 221 | o2.BrickColor = BrickColor.new("Hot pink")
| |
| 222 | o2.Position = Vector3.new(15.9000006, -8.5, 3.20000005) | |
| 223 | o2.FormFactor = Enum.FormFactor.Custom | |
| 224 | o2.Size = Vector3.new(0.200000003, 1, 3.5999999) | |
| 225 | o2.CFrame = CFrame.new(15.9000006, -8.5, 3.20000005, 1, 0, 0, 0, 1, 0, 0, 0, 1) | |
| 226 | o2.BottomSurface = Enum.SurfaceType.Smooth | |
| 227 | o2.TopSurface = Enum.SurfaceType.Smooth | |
| 228 | o2.Color = Color3.new(0.105882, 0.164706, 0.207843) | |
| 229 | o2.Position = Vector3.new(15.9000006, -8.5, 3.20000005) | |
| 230 | o3.Parent = o2 | |
| 231 | o3.MeshId = "http://www.roblox.com/asset/?id=2761723" | |
| 232 | o3.Scale = Vector3.new(1.33000004, 1.33000004, 1.33000004) | |
| 233 | o3.TextureId = "http://www.roblox.com/asset?ID=56168143" | |
| 234 | o3.MeshType = Enum.MeshType.FileMesh | |
| 235 | o4.Name = "FireSound" | |
| 236 | o4.Parent = o2 | |
| 237 | o4.Pitch = 1.3999999761581 | |
| 238 | o4.SoundId = "http://www.roblox.com/asset/?id=10209821" | |
| 239 | o4.Volume = 1 | |
| 240 | o5.Name = "Reload" | |
| 241 | o5.Parent = o2 | |
| 242 | o5.SoundId = "http://www.roblox.com/asset/?id=97094986" | |
| 243 | o5.Volume = 1 | |
| 244 | o6.Name = "EquipSound" | |
| 245 | o6.Parent = o2 | |
| 246 | o6.SoundId = "http://www.roblox.com/asset/?id=10209881" | |
| 247 | o6.Volume = 1 | |
| 248 | o7.Name = "Flash" | |
| 249 | o7.Parent = o2 | |
| 250 | o7.Color = Color3.new(1, 1, 0) | |
| 251 | o7.Enabled = false | |
| 252 | o7.Brightness = 1.5 | |
| 253 | o8.Name = "Tick" | |
| 254 | o8.Parent = o2 | |
| 255 | o8.SoundId = "rbxasset://sounds//clickfast.wav" | |
| 256 | o8.Volume = 1 | |
| 257 | o10.Name = "AUG" | |
| 258 | o10.Parent = o1 | |
| 259 | print("Eu vou nm e cume seus amigos >:)
| |
| 260 | table.insert(cors,coroutine.create(function() | |
| 261 | wait() | |
| 262 | runDummyScript(function() | |
| 263 | --------------------- TEMPLATE ASSAULT RIFLE WEAPON --------------------------- | |
| 264 | -- Waits for the child of the specified parent | |
| 265 | local function WaitForChild(parent, childName) | |
| 266 | while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end | |
| 267 | return parent[childName] | |
| 268 | end | |
| 269 | ||
| 270 | ----- MAGIC NUMBERS ABOUT THE TOOL ----- | |
| 271 | -- How much damage a bullet does | |
| 272 | local Damage = math.huge | |
| 273 | -- How many times per second the gun can fire | |
| 274 | local FireRate = 1 / 15 | |
| 275 | -- The maximum distance the can can shoot, this value should never go above 1000 | |
| 276 | local Range = 700 | |
| 277 | -- In radians the minimum accuracy penalty | |
| 278 | local MinSpread = 0.01 | |
| 279 | -- In radian the maximum accuracy penalty | |
| 280 | local MaxSpread = 0.06 | |
| 281 | -- Number of bullets in a clip | |
| 282 | local ClipSize = math.huge | |
| 283 | -- DefaultValue for spare ammo | |
| 284 | local SpareAmmo = math.huge | |
| 285 | -- The amount the aim will increase or decrease by | |
| 286 | -- decreases this number reduces the speed that recoil takes effect | |
| 287 | local AimInaccuracyStepAmount = 0.01 | |
| 288 | -- Time it takes to reload weapon | |
| 289 | local ReloadTime = 2.3 | |
| 290 | ---------------------------------------- | |
| 291 | ||
| 292 | -- Colors | |
| 293 | local FriendlyReticleColor = Color3.new(0, 1, 0) | |
| 294 | local EnemyReticleColor = Color3.new(1, 0, 0) | |
| 295 | local NeutralReticleColor = Color3.new(1, 1, 1) | |
| 296 | ||
| 297 | local Spread = MinSpread | |
| 298 | local AmmoInClip = ClipSize | |
| 299 | ||
| 300 | local Tool = o1 | |
| 301 | local Handle = WaitForChild(Tool, 'Handle') | |
| 302 | local WeaponGui = nil | |
| 303 | ||
| 304 | local LeftButtonDown | |
| 305 | local Reloading = false | |
| 306 | local IsShooting = false | |
| 307 | ||
| 308 | -- Player specific convenience variables | |
| 309 | local MyPlayer = nil | |
| 310 | local MyCharacter = nil | |
| 311 | local MyHumanoid = nil | |
| 312 | local MyTorso = nil | |
| 313 | local MyMouse = nil | |
| 314 | ||
| 315 | local RecoilAnim | |
| 316 | local RecoilTrack = nil | |
| 317 | ||
| 318 | local IconURL = Tool.TextureId -- URL to the weapon icon asset | |
| 319 | ||
| 320 | local DebrisService = game:GetService('Debris')
| |
| 321 | local PlayersService = game:GetService('Players')
| |
| 322 | ||
| 323 | ||
| 324 | local FireSound | |
| 325 | ||
| 326 | local OnFireConnection = nil | |
| 327 | local OnReloadConnection = nil | |
| 328 | ||
| 329 | local DecreasedAimLastShot = false | |
| 330 | local LastSpreadUpdate = time() | |
| 331 | ||
| 332 | -- this is a dummy object that holds the flash made when the gun is fired | |
| 333 | local FlashHolder = nil | |
| 334 | ||
| 335 | ||
| 336 | local WorldToCellFunction = Workspace.Terrain.WorldToCellPreferSolid | |
| 337 | local GetCellFunction = Workspace.Terrain.GetCell | |
| 338 | ||
| 339 | function RayIgnoreCheck(hit, pos) | |
| 340 | if hit then | |
| 341 | if hit.Transparency >= 1 or string.lower(hit.Name) == "water" or | |
| 342 | hit.Name == "Effect" or hit.Name == "Rocket" or hit.Name == "Bullet" or | |
| 343 | hit.Name == "Handle" or hit:IsDescendantOf(MyCharacter) then | |
| 344 | return true | |
| 345 | elseif hit:IsA('Terrain') and pos then
| |
| 346 | local cellPos = WorldToCellFunction(Workspace.Terrain, pos) | |
| 347 | if cellPos then | |
| 348 | local cellMat = GetCellFunction(Workspace.Terrain, cellPos.x, cellPos.y, cellPos.z) | |
| 349 | if cellMat and cellMat == Enum.CellMaterial.Water then | |
| 350 | return true | |
| 351 | end | |
| 352 | end | |
| 353 | end | |
| 354 | end | |
| 355 | return false | |
| 356 | end | |
| 357 | ||
| 358 | -- @preconditions: vec should be a unit vector, and 0 < rayLength <= 1000 | |
| 359 | function RayCast(startPos, vec, rayLength) | |
| 360 | local hitObject, hitPos = game.Workspace:FindPartOnRay(Ray.new(startPos + (vec * .01), vec * rayLength), Handle) | |
| 361 | if hitObject and hitPos then | |
| 362 | local distance = rayLength - (hitPos - startPos).magnitude | |
| 363 | if RayIgnoreCheck(hitObject, hitPos) and distance > 0 then | |
| 364 | -- there is a chance here for potential infinite recursion | |
| 365 | return RayCast(hitPos, vec, distance) | |
| 366 | end | |
| 367 | end | |
| 368 | return hitObject, hitPos | |
| 369 | end | |
| 370 | ||
| 371 | ||
| 372 | ||
| 373 | function TagHumanoid(humanoid, player) | |
| 374 | -- Add more tags here to customize what tags are available. | |
| 375 | while humanoid:FindFirstChild('creator') do
| |
| 376 | humanoid:FindFirstChild('creator'):Destroy()
| |
| 377 | end | |
| 378 | local creatorTag = Instance.new("ObjectValue")
| |
| 379 | creatorTag.Value = player | |
| 380 | creatorTag.Name = "creator" | |
| 381 | creatorTag.Parent = humanoid | |
| 382 | DebrisService:AddItem(creatorTag, 1.5) | |
| 383 | ||
| 384 | local weaponIconTag = Instance.new("StringValue")
| |
| 385 | weaponIconTag.Value = IconURL | |
| 386 | weaponIconTag.Name = "icon" | |
| 387 | weaponIconTag.Parent = creatorTag | |
| 388 | end | |
| 389 | ||
| 390 | ||
| 391 | local function CreateBullet(bulletPos) | |
| 392 | local bullet = Instance.new('Part', Workspace)
| |
| 393 | bullet.FormFactor = Enum.FormFactor.Custom | |
| 394 | bullet.Size = Vector3.new(0.1, 0.1, 0.1) | |
| 395 | bullet.BrickColor = BrickColor.new("Black")
| |
| 396 | bullet.Shape = Enum.PartType.Block | |
| 397 | bullet.CanCollide = false | |
| 398 | bullet.CFrame = CFrame.new(bulletPos) | |
| 399 | bullet.Anchored = true | |
| 400 | bullet.TopSurface = Enum.SurfaceType.Smooth | |
| 401 | bullet.BottomSurface = Enum.SurfaceType.Smooth | |
| 402 | bullet.Name = 'Bullet' | |
| 403 | DebrisService:AddItem(bullet, 2.5) | |
| 404 | return bullet | |
| 405 | end | |
| 406 | ||
| 407 | local function Reload() | |
| 408 | if not Reloading then | |
| 409 | Reloading = true | |
| 410 | -- Don't reload if you are already full or have no extra ammo | |
| 411 | if AmmoInClip ~= ClipSize and SpareAmmo > 0 then | |
| 412 | if RecoilTrack then | |
| 413 | RecoilTrack:Stop() | |
| 414 | end | |
| 415 | if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then
| |
| 416 | if WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
| |
| 417 | WeaponGui.Crosshair.ReloadingLabel.Visible = true | |
| 418 | end | |
| 419 | end | |
| 420 | script.Parent.Handle.Reload:Play() | |
| 421 | wait(ReloadTime) | |
| 422 | -- Only use as much ammo as you have | |
| 423 | local ammoToUse = math.min(ClipSize - AmmoInClip, SpareAmmo) | |
| 424 | AmmoInClip = AmmoInClip + ammoToUse | |
| 425 | SpareAmmo = SpareAmmo - ammoToUse | |
| 426 | UpdateAmmo(AmmoInClip) | |
| 427 | WeaponGui.Reload.Visible = false | |
| 428 | end | |
| 429 | Reloading = false | |
| 430 | end | |
| 431 | end | |
| 432 | ||
| 433 | function OnFire() | |
| 434 | if IsShooting then return end | |
| 435 | if MyHumanoid and MyHumanoid.Health > 0 then | |
| 436 | if RecoilTrack and AmmoInClip > 0 then | |
| 437 | RecoilTrack:Play() | |
| 438 | end | |
| 439 | IsShooting = true | |
| 440 | while LeftButtonDown and AmmoInClip > 0 and not Reloading do | |
| 441 | if Spread and not DecreasedAimLastShot then | |
| 442 | Spread = math.min(MaxSpread, Spread + AimInaccuracyStepAmount) | |
| 443 | UpdateCrosshair(Spread) | |
| 444 | end | |
| 445 | DecreasedAimLastShot = not DecreasedAimLastShot | |
| 446 | if Handle:FindFirstChild('FireSound') then
| |
| 447 | Handle.FireSound:Play() | |
| 448 | Handle.Flash.Enabled = true | |
| 449 | end | |
| 450 | if MyMouse then | |
| 451 | local targetPoint = MyMouse.Hit.p | |
| 452 | local shootDirection = (targetPoint - Handle.Position).unit | |
| 453 | -- Adjust the shoot direction randomly off by a little bit to account for recoil | |
| 454 | shootDirection = CFrame.Angles((0.5 - math.random()) * 2 * Spread, | |
| 455 | (0.5 - math.random()) * 2 * Spread, | |
| 456 | (0.5 - math.random()) * 2 * Spread) * shootDirection | |
| 457 | local hitObject, bulletPos = RayCast(Handle.Position, shootDirection, Range) | |
| 458 | local bullet | |
| 459 | -- Create a bullet here | |
| 460 | if hitObject then | |
| 461 | bullet = CreateBullet(bulletPos) | |
| 462 | end | |
| 463 | if hitObject and hitObject.Parent then | |
| 464 | local hitHumanoid = hitObject.Parent:FindFirstChild("Humanoid")
| |
| 465 | if hitHumanoid then | |
| 466 | local hitPlayer = game.Players:GetPlayerFromCharacter(hitHumanoid.Parent) | |
| 467 | if MyPlayer.Neutral or hitPlayer then | |
| 468 | TagHumanoid(hitHumanoid, MyPlayer) | |
| 469 | hitHumanoid:TakeDamage(Damage) | |
| 470 | if bullet then | |
| 471 | bullet:Destroy() | |
| 472 | bullet = nil | |
| 473 | --bullet.Transparency = 1 | |
| 474 | end | |
| 475 | Spawn(UpdateTargetHit) | |
| 476 | end | |
| 477 | end | |
| 478 | end | |
| 479 | ||
| 480 | AmmoInClip = AmmoInClip - 1 | |
| 481 | UpdateAmmo(AmmoInClip) | |
| 482 | end | |
| 483 | wait(FireRate) | |
| 484 | end | |
| 485 | Handle.Flash.Enabled = false | |
| 486 | IsShooting = false | |
| 487 | if AmmoInClip == 0 then | |
| 488 | Handle.Tick:Play() | |
| 489 | WeaponGui.Reload.Visible = true | |
| 490 | end | |
| 491 | if RecoilTrack then | |
| 492 | RecoilTrack:Stop() | |
| 493 | end | |
| 494 | end | |
| 495 | end | |
| 496 | ||
| 497 | local TargetHits = 0 | |
| 498 | function UpdateTargetHit() | |
| 499 | TargetHits = TargetHits + 1 | |
| 500 | if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
| |
| 501 | WeaponGui.Crosshair.TargetHitImage.Visible = true | |
| 502 | end | |
| 503 | wait(0.5) | |
| 504 | TargetHits = TargetHits - 1 | |
| 505 | if TargetHits == 0 and WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
| |
| 506 | WeaponGui.Crosshair.TargetHitImage.Visible = false | |
| 507 | end | |
| 508 | end | |
| 509 | ||
| 510 | function UpdateCrosshair(value, mouse) | |
| 511 | if WeaponGui then | |
| 512 | local absoluteY = 650 | |
| 513 | WeaponGui.Crosshair:TweenSize( | |
| 514 | UDim2.new(0, value * absoluteY * 2 + 23, 0, value * absoluteY * 2 + 23), | |
| 515 | Enum.EasingDirection.Out, | |
| 516 | Enum.EasingStyle.Linear, | |
| 517 | 0.33) | |
| 518 | end | |
| 519 | end | |
| 520 | ||
| 521 | function UpdateAmmo(value) | |
| 522 | if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('ClipAmmo') then
| |
| 523 | WeaponGui.AmmoHud.ClipAmmo.Text = AmmoInClip | |
| 524 | if value > 0 and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
| |
| 525 | WeaponGui.Crosshair.ReloadingLabel.Visible = false | |
| 526 | end | |
| 527 | end | |
| 528 | if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('TotalAmmo') then
| |
| 529 | WeaponGui.AmmoHud.TotalAmmo.Text = SpareAmmo | |
| 530 | end | |
| 531 | end | |
| 532 | ||
| 533 | ||
| 534 | function OnMouseDown() | |
| 535 | LeftButtonDown = true | |
| 536 | OnFire() | |
| 537 | end | |
| 538 | ||
| 539 | function OnMouseUp() | |
| 540 | LeftButtonDown = false | |
| 541 | end | |
| 542 | ||
| 543 | function OnKeyDown(key) | |
| 544 | if string.lower(key) == 'r' then | |
| 545 | Reload() | |
| 546 | end | |
| 547 | end | |
| 548 | ||
| 549 | ||
| 550 | function OnEquipped(mouse) | |
| 551 | Handle.EquipSound:Play() | |
| 552 | RecoilAnim = WaitForChild(Tool, 'Recoil') | |
| 553 | FireSound = WaitForChild(Handle, 'FireSound') | |
| 554 | ||
| 555 | MyCharacter = Tool.Parent | |
| 556 | MyPlayer = game:GetService('Players'):GetPlayerFromCharacter(MyCharacter)
| |
| 557 | MyHumanoid = MyCharacter:FindFirstChild('Humanoid')
| |
| 558 | MyTorso = MyCharacter:FindFirstChild('Torso')
| |
| 559 | MyMouse = mouse | |
| 560 | WeaponGui = WaitForChild(Tool, 'WeaponHud'):Clone() | |
| 561 | if WeaponGui and MyPlayer then | |
| 562 | WeaponGui.Parent = MyPlayer.PlayerGui | |
| 563 | UpdateAmmo(AmmoInClip) | |
| 564 | end | |
| 565 | if RecoilAnim then | |
| 566 | RecoilTrack = MyHumanoid:LoadAnimation(RecoilAnim) | |
| 567 | end | |
| 568 | ||
| 569 | if MyMouse then | |
| 570 | -- Disable mouse icon | |
| 571 | MyMouse.Icon = "http://www.roblox.com/asset/?id=142406345" | |
| 572 | MyMouse.Button1Down:connect(OnMouseDown) | |
| 573 | MyMouse.Button1Up:connect(OnMouseUp) | |
| 574 | MyMouse.KeyDown:connect(OnKeyDown) | |
| 575 | end | |
| 576 | end | |
| 577 | ||
| 578 | ||
| 579 | -- Unequip logic here | |
| 580 | function OnUnequipped() | |
| 581 | LeftButtonDown = false | |
| 582 | Reloading = false | |
| 583 | MyCharacter = nil | |
| 584 | MyHumanoid = nil | |
| 585 | MyTorso = nil | |
| 586 | MyPlayer = nil | |
| 587 | MyMouse = nil | |
| 588 | if OnFireConnection then | |
| 589 | OnFireConnection:disconnect() | |
| 590 | end | |
| 591 | if OnReloadConnection then | |
| 592 | OnReloadConnection:disconnect() | |
| 593 | end | |
| 594 | if FlashHolder then | |
| 595 | FlashHolder = nil | |
| 596 | end | |
| 597 | if WeaponGui then | |
| 598 | WeaponGui.Parent = nil | |
| 599 | WeaponGui = nil | |
| 600 | end | |
| 601 | if RecoilTrack then | |
| 602 | RecoilTrack:Stop() | |
| 603 | end | |
| 604 | end | |
| 605 | ||
| 606 | local function SetReticleColor(color) | |
| 607 | if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then
| |
| 608 | for _, line in pairs(WeaponGui.Crosshair:GetChildren()) do | |
| 609 | if line:IsA('Frame') then
| |
| 610 | line.BorderColor3 = color | |
| 611 | end | |
| 612 | end | |
| 613 | end | |
| 614 | end | |
| 615 | ||
| 616 | ||
| 617 | Tool.Equipped:connect(OnEquipped) | |
| 618 | Tool.Unequipped:connect(OnUnequipped) | |
| 619 | ||
| 620 | while true do | |
| 621 | wait(0.033) | |
| 622 | if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and MyMouse then
| |
| 623 | WeaponGui.Crosshair.Position = UDim2.new(0, MyMouse.X, 0, MyMouse.Y) | |
| 624 | SetReticleColor(NeutralReticleColor) | |
| 625 | ||
| 626 | local target = MyMouse.Target | |
| 627 | if target and target.Parent then | |
| 628 | local player = PlayersService:GetPlayerFromCharacter(target.Parent) | |
| 629 | if player then | |
| 630 | if MyPlayer.Neutral or player.TeamColor ~= MyPlayer.TeamColor then | |
| 631 | SetReticleColor(EnemyReticleColor) | |
| 632 | else | |
| 633 | SetReticleColor(FriendlyReticleColor) | |
| 634 | end | |
| 635 | end | |
| 636 | end | |
| 637 | end | |
| 638 | if Spread and not IsShooting then | |
| 639 | local currTime = time() | |
| 640 | if currTime - LastSpreadUpdate > FireRate * 2 then | |
| 641 | LastSpreadUpdate = currTime | |
| 642 | Spread = math.max(MinSpread, Spread - AimInaccuracyStepAmount) | |
| 643 | UpdateCrosshair(Spread, MyMouse) | |
| 644 | end | |
| 645 | end | |
| 646 | end | |
| 647 | ||
| 648 | end,o10) | |
| 649 | end)) | |
| 650 | o11.Name = "Recoil" | |
| 651 | o11.Parent = o1 | |
| 652 | o11.AnimationId = "http://www.roblox.com/Asset?ID=94331086" | |
| 653 | o12.Name = "WeaponHud" | |
| 654 | o12.Parent = o1 | |
| 655 | o13.Name = "AmmoHud" | |
| 656 | o13.Parent = o12 | |
| 657 | o13.Position = UDim2.new(1,-265,1,-60) | |
| 658 | o13.Size = UDim2.new(0,200,0,50) | |
| 659 | o13.Style = Enum.FrameStyle.RobloxSquare | |
| 660 | o13.Position = UDim2.new(1,-265,1,-60) | |
| 661 | o13.BackgroundTransparency = 1 | |
| 662 | o13.BorderSizePixel = 0 | |
| 663 | o14.Name = "ForwardSlash" | |
| 664 | o14.Parent = o13 | |
| 665 | o14.Position = UDim2.new(0.5,0,0.5,0) | |
| 666 | o14.Text = "/" | |
| 667 | o14.Position = UDim2.new(0.5,0,0.5,0) | |
| 668 | o14.BackgroundTransparency = 1 | |
| 669 | o14.BorderSizePixel = 0 | |
| 670 | o14.FontSize = Enum.FontSize.Size24 | |
| 671 | o14.TextColor3 = Color3.new(1, 1, 1) | |
| 672 | o14.TextStrokeTransparency = 0 | |
| 673 | o15.Name = "ClipAmmo" | |
| 674 | o15.Parent = o13 | |
| 675 | o15.Position = UDim2.new(0.44999998807907,0,0.5,0) | |
| 676 | o15.Text = "54" | |
| 677 | o15.Position = UDim2.new(0.44999998807907,0,0.5,0) | |
| 678 | o15.BackgroundTransparency = 1 | |
| 679 | o15.BorderSizePixel = 0 | |
| 680 | o15.FontSize = Enum.FontSize.Size24 | |
| 681 | o15.TextColor3 = Color3.new(1, 1, 1) | |
| 682 | o15.TextStrokeTransparency = 0 | |
| 683 | o15.TextXAlignment = Enum.TextXAlignment.Right | |
| 684 | o16.Name = "TotalAmmo" | |
| 685 | o16.Parent = o13 | |
| 686 | o16.Position = UDim2.new(0.55000001192093,0,0.5,0) | |
| 687 | o16.Text = "180" | |
| 688 | o16.Position = UDim2.new(0.55000001192093,0,0.5,0) | |
| 689 | o16.BackgroundTransparency = 1 | |
| 690 | o16.BorderSizePixel = 0 | |
| 691 | o16.FontSize = Enum.FontSize.Size24 | |
| 692 | o16.TextColor3 = Color3.new(1, 1, 1) | |
| 693 | o16.TextStrokeTransparency = 0 | |
| 694 | o16.TextXAlignment = Enum.TextXAlignment.Left | |
| 695 | o17.Name = "Crosshair" | |
| 696 | o17.Parent = o12 | |
| 697 | o17.Position = UDim2.new(0,500,0,500) | |
| 698 | o17.Size = UDim2.new(0,150,0,150) | |
| 699 | o17.Position = UDim2.new(0,500,0,500) | |
| 700 | o17.BackgroundColor3 = Color3.new(0, 1, 0) | |
| 701 | o17.BackgroundTransparency = 1 | |
| 702 | o17.BorderSizePixel = 0 | |
| 703 | o18.Name = "TopFrame" | |
| 704 | o18.Parent = o17 | |
| 705 | o18.Position = UDim2.new(0,-1,-0.5,-7) | |
| 706 | o18.Size = UDim2.new(0,2,0,14) | |
| 707 | o18.Position = UDim2.new(0,-1,-0.5,-7) | |
| 708 | o18.BackgroundColor3 = Color3.new(1, 1, 1) | |
| 709 | o18.BorderColor3 = Color3.new(0, 0, 0) | |
| 710 | o19.Name = "RightFrame" | |
| 711 | o19.Parent = o17 | |
| 712 | o19.Position = UDim2.new(0.5,-7,0,-1) | |
| 713 | o19.Size = UDim2.new(0,14,0,2) | |
| 714 | o19.Position = UDim2.new(0.5,-7,0,-1) | |
| 715 | o19.BackgroundColor3 = Color3.new(1, 1, 1) | |
| 716 | o19.BorderColor3 = Color3.new(0, 0, 0) | |
| 717 | o20.Name = "LeftFrame" | |
| 718 | o20.Parent = o17 | |
| 719 | o20.Position = UDim2.new(-0.5,-7,0,-1) | |
| 720 | o20.Size = UDim2.new(0,14,0,2) | |
| 721 | o20.Position = UDim2.new(-0.5,-7,0,-1) | |
| 722 | o20.BackgroundColor3 = Color3.new(1, 1, 1) | |
| 723 | o20.BorderColor3 = Color3.new(0, 0, 0) | |
| 724 | o21.Name = "TargetHitImage" | |
| 725 | o21.Parent = o17 | |
| 726 | o21.Position = UDim2.new(0,-25,0,-25) | |
| 727 | o21.Size = UDim2.new(0,50,0,50) | |
| 728 | o21.Position = UDim2.new(0,-25,0,-25) | |
| 729 | o21.Visible = false | |
| 730 | o21.BackgroundTransparency = 1 | |
| 731 | o21.BorderSizePixel = 0 | |
| 732 | o21.Image = "http://www.roblox.com/asset/?id=115400215" | |
| 733 | o22.Name = "ReloadingLabel" | |
| 734 | o22.Parent = o17 | |
| 735 | o22.Position = UDim2.new(0,20,0,-20) | |
| 736 | o22.Text = "Reloading" | |
| 737 | o22.Position = UDim2.new(0,20,0,-20) | |
| 738 | o22.Visible = false | |
| 739 | o22.BackgroundTransparency = 1 | |
| 740 | o22.BorderSizePixel = 0 | |
| 741 | o22.Font = Enum.Font.ArialBold | |
| 742 | o22.FontSize = Enum.FontSize.Size18 | |
| 743 | o22.TextColor3 = Color3.new(1, 1, 1) | |
| 744 | o22.TextStrokeTransparency = 0 | |
| 745 | o22.TextXAlignment = Enum.TextXAlignment.Left | |
| 746 | o22.TextYAlignment = Enum.TextYAlignment.Bottom | |
| 747 | o23.Name = "BottomFrame" | |
| 748 | o23.Parent = o17 | |
| 749 | o23.Position = UDim2.new(0,-1,0.5,-7) | |
| 750 | o23.Size = UDim2.new(0,2,0,14) | |
| 751 | o23.Position = UDim2.new(0,-1,0.5,-7) | |
| 752 | o23.BackgroundColor3 = Color3.new(1, 1, 1) | |
| 753 | o23.BorderColor3 = Color3.new(0, 0, 0) | |
| 754 | o24.Name = "Reload" | |
| 755 | o24.Parent = o12 | |
| 756 | o24.Position = UDim2.new(1,-265,1,-120) | |
| 757 | o24.Size = UDim2.new(0,200,0,50) | |
| 758 | o24.Position = UDim2.new(1,-265,1,-120) | |
| 759 | o24.Visible = false | |
| 760 | o24.BackgroundTransparency = 1 | |
| 761 | o24.BorderSizePixel = 0 | |
| 762 | o25.Name = "Reload" | |
| 763 | o25.Parent = o24 | |
| 764 | o25.Position = UDim2.new(0.5,0,0.5,0) | |
| 765 | o25.Text = "Press R to Reload" | |
| 766 | o25.Position = UDim2.new(0.5,0,0.5,0) | |
| 767 | o25.BackgroundTransparency = 1 | |
| 768 | o25.BorderSizePixel = 0 | |
| 769 | o25.Font = Enum.Font.ArialBold | |
| 770 | o25.FontSize = Enum.FontSize.Size24 | |
| 771 | o25.TextColor3 = Color3.new(1, 0, 0) | |
| 772 | o25.TextStrokeTransparency = 0 | |
| 773 | o26.Name = "ArmWeld [Rifle]" | |
| 774 | o26.Parent = o1 | |
| 775 | table.insert(cors,coroutine.create(function() | |
| 776 | wait() | |
| 777 | runDummyScript(function() | |
| 778 | Tool = script.Parent; | |
| 779 | ||
| 780 | local arms = nil | |
| 781 | local torso = nil | |
| 782 | local welds = {}
| |
| 783 | ||
| 784 | function Equip(mouse) | |
| 785 | wait(0.01) | |
| 786 | arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
| |
| 787 | torso = Tool.Parent:FindFirstChild("Torso")
| |
| 788 | if arms ~= nil and torso ~= nil then | |
| 789 | local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
| |
| 790 | if sh ~= nil then | |
| 791 | local yes = true | |
| 792 | if yes then | |
| 793 | yes = false | |
| 794 | sh[1].Part1 = nil | |
| 795 | sh[2].Part1 = nil | |
| 796 | local weld1 = Instance.new("Weld")
| |
| 797 | weld1.Part0 = torso | |
| 798 | weld1.Parent = torso | |
| 799 | weld1.Part1 = arms[1] | |
| 800 | 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 | |
| 801 | welds[1] = weld1 | |
| 802 | weld1.Name = "weld1" | |
| 803 | local weld2 = Instance.new("Weld")
| |
| 804 | weld2.Part0 = torso | |
| 805 | weld2.Parent = torso | |
| 806 | weld2.Part1 = arms[2] | |
| 807 | weld2.C1 = CFrame.new(-1, -0.2, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0) --- Same as top | |
| 808 | welds[2] = weld2 | |
| 809 | weld2.Name = "weld2" | |
| 810 | end | |
| 811 | else | |
| 812 | print("sh")
| |
| 813 | end | |
| 814 | else | |
| 815 | print("arms")
| |
| 816 | end | |
| 817 | end | |
| 818 | ||
| 819 | function Unequip(mouse) | |
| 820 | if arms ~= nil and torso ~= nil then | |
| 821 | local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
| |
| 822 | if sh ~= nil then | |
| 823 | local yes = true | |
| 824 | if yes then | |
| 825 | yes = false | |
| 826 | sh[1].Part1 = arms[1] | |
| 827 | sh[2].Part1 = arms[2] | |
| 828 | welds[1].Parent = nil | |
| 829 | welds[2].Parent = nil | |
| 830 | end | |
| 831 | else | |
| 832 | print("sh")
| |
| 833 | end | |
| 834 | else | |
| 835 | print("arms")
| |
| 836 | end | |
| 837 | end | |
| 838 | Tool.Equipped:connect(Equip) | |
| 839 | Tool.Unequipped:connect(Unequip) | |
| 840 | ||
| 841 | end,o26) | |
| 842 | end)) | |
| 843 | mas.Parent = workspace | |
| 844 | mas:MakeJoints() | |
| 845 | local mas1 = mas:GetChildren() | |
| 846 | for i=1,#mas1 do | |
| 847 | mas1[i].Parent = workspace | |
| 848 | ypcall(function() mas1[i]:MakeJoints() end) | |
| 849 | end | |
| 850 | mas:Destroy() | |
| 851 | for i=1,#cors do | |
| 852 | coroutine.resume(cors[i]) | |
| 853 | end |