Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --https://github.com/Mokiros/roblox-FE-compatibility
- if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
- local Player,game,owner = owner,game
- local RealPlayer = Player
- do print("FE Compatibility code V2 by Mokiros")local RealPlayer=RealPlayer;script.Parent=RealPlayer.Character;local a=function(b)b[1].f[b[2]]=nil end;local c={__index={disconnect=a,Disconnect=a}}local d={__index={Connect=function(b,e)local f=tostring(math.random(0,10000))while b.f[f]do f=tostring(math.random(0,10000))end;b.f[f]=e;return setmetatable({b,f},c)end}}d.__index.connect=d.__index.Connect;local function g()return setmetatable({f={}},d)end;local h={Hit=CFrame.new(),KeyUp=g(),KeyDown=g(),Button1Up=g(),Button1Down=g(),Button2Up=g(),Button2Down=g()}h.keyUp=h.KeyUp;h.keyDown=h.KeyDown;local i={InputBegan=g(),InputEnded=g()}local CAS={Actions={},BindAction=function(self,j,k,l,...)CAS.Actions[j]=k and{Name=j,Function=k,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function m(self,n,...)for o,e in pairs(self[n].f)do e(...)end end;h.T=m;i.T=m;local p=Instance.new("RemoteEvent")p.Name="UserInput_Event"p.OnServerEvent:Connect(function(q,r)if q~=RealPlayer then return end;h.Target=r.e;h.Hit=r.d;if not r.f then local s=r.c==Enum.UserInputState.Begin;if r.b==Enum.UserInputType.MouseButton1 then return h:T(s and"Button1Down"or"Button1Up")end;if r.b==Enum.UserInputType.MouseButton2 then return h:T(s and"Button2Down"or"Button2Up")end;for o,t in pairs(CAS.Actions)do for o,u in pairs(t.Keys)do if u==r.a then t.Function(t.Name,r.c,r)end end end;h:T(s and"KeyDown"or"KeyUp",r.a.Name:lower())i:T(s and"InputBegan"or"InputEnded",r,false)end end)p.Parent=NLS([==[local a=script:WaitForChild("UserInput_Event")local b=owner:GetMouse()local c=game:GetService("UserInputService")local d=function(e,f)if f then return end;a:FireServer({a=e.KeyCode,b=e.UserInputType,c=e.UserInputState,d=b.Hit,e=b.Target})end;c.InputBegan:Connect(d)c.InputEnded:Connect(d)local g,h;local i=game:GetService("RunService").Heartbeat;while true do if g~=b.Hit or h~=b.Target then g,h=b.Hit,b.Target;a:FireServer({f=1,Target=h,d=g})end;for j=1,2 do i:Wait()end end]==],script)local v=game;local w={__index=function(self,u)local x=rawget(self,"_RealService")if x then return typeof(x[u])=="function"and function(o,...)return x[u](x,...)end or x[u]end end,__newindex=function(self,u,y)local x=rawget(self,"_RealService")if x then x[u]=y end end}local function z(t,A)t._RealService=typeof(A)=="string"and v:GetService(A)or A;return setmetatable(t,w)end;local B={GetService=function(self,x)return rawget(self,x)or v:GetService(x)end,Players=z({LocalPlayer=z({GetMouse=function(self)return h end},Player)},"Players"),UserInputService=z(i,"UserInputService"),ContextActionService=z(CAS,"ContextActionService"),RunService=z({_btrs={},RenderStepped=v:GetService("RunService").Heartbeat,BindToRenderStep=function(self,j,o,k)self._btrs[j]=self.Heartbeat:Connect(k)end,UnbindFromRenderStep=function(self,j)self._btrs[j]:Disconnect()end},"RunService")}rawset(B.Players,"localPlayer",B.Players.LocalPlayer)B.service=B.GetService;z(B,game)game,owner=B,B.Players.LocalPlayer end
- --Converted with ttyyuu12345's model to script plugin v4
- local Player = game.Players.LocalPlayer
- local gear = workspace.Handgun
- function sandbox(var,func)
- local env = getfenv(func)
- local newenv = setmetatable({},{
- __index = function(self,k)
- if k=="script" then
- return var
- else
- return env[k]
- end
- end,
- })
- setfenv(func,newenv)
- return func
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- Camera0 = Instance.new("Camera")
- Part1 = Instance.new("Part")
- Tool2 = Instance.new("Tool")
- UnionOperation3 = Instance.new("UnionOperation")
- Sound4 = Instance.new("Sound")
- Sound5 = Instance.new("Sound")
- Sound6 = Instance.new("Sound")
- Sound7 = Instance.new("Sound")
- PointLight8 = Instance.new("PointLight")
- Smoke9 = Instance.new("Smoke")
- Sound10 = Instance.new("Sound")
- Sound11 = Instance.new("Sound")
- Animation12 = Instance.new("Animation")
- LocalScript13 = Instance.new("LocalScript")
- Script14 = Instance.new("Script")
- Part15 = Instance.new("Part")
- BillboardGui16 = Instance.new("BillboardGui")
- ImageLabel17 = Instance.new("ImageLabel")
- Script18 = Instance.new("Script")
- Animation19 = Instance.new("Animation")
- Script20 = Instance.new("Script")
- Camera21 = Instance.new("Camera")
- ScreenGui22 = Instance.new("ScreenGui")
- Frame23 = Instance.new("Frame")
- TextLabel24 = Instance.new("TextLabel")
- TextLabel25 = Instance.new("TextLabel")
- TextLabel26 = Instance.new("TextLabel")
- ImageLabel27 = Instance.new("ImageLabel")
- Frame28 = Instance.new("Frame")
- Frame29 = Instance.new("Frame")
- Frame30 = Instance.new("Frame")
- Frame31 = Instance.new("Frame")
- ImageLabel32 = Instance.new("ImageLabel")
- TextLabel33 = Instance.new("TextLabel")
- Frame34 = Instance.new("Frame")
- Sound35 = Instance.new("Sound")
- Script36 = Instance.new("Script")
- Script37 = Instance.new("Script")
- Camera0.Parent = mas
- Camera0.CFrame = CFrame.new(0.321689844, 18.2346153, 23.7645969, 0.98357147, -0.0819535926, 0.160844535, -0, 0.891008377, 0.453987002, -0.180519685, -0.446528673, 0.876370251)
- Camera0.CoordinateFrame = CFrame.new(0.321689844, 18.2346153, 23.7645969, 0.98357147, -0.0819535926, 0.160844535, -0, 0.891008377, 0.453987002, -0.180519685, -0.446528673, 0.876370251)
- Camera0.Focus = CFrame.new(0, 17.3266392, 22.0118523, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Camera0.focus = CFrame.new(0, 17.3266392, 22.0118523, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part1.Name = "Baseplate"
- Part1.Parent = mas
- Part1.CFrame = CFrame.new(0, -10, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part1.Position = Vector3.new(0, -10, 0)
- Part1.Color = Color3.new(0.388235, 0.372549, 0.384314)
- Part1.Size = Vector3.new(512, 20, 512)
- Part1.Anchored = true
- Part1.BrickColor = BrickColor.new("Dark stone grey")
- Part1.Locked = true
- Part1.brickColor = BrickColor.new("Dark stone grey")
- Part1.FormFactor = Enum.FormFactor.Symmetric
- Part1.formFactor = Enum.FormFactor.Symmetric
- Tool2.Name = "Handgun"
- Tool2.Parent = mas
- Tool2.TextureId = "http://www.roblox.com/asset/?id=122080118"
- Tool2.CanBeDropped = false
- Tool2.Grip = CFrame.new(0, -0.349999994, -0.100000016, -0.998458922, 0.0554731078, 0.00161359028, 0.0554737262, 0.998460174, 0.000344417145, -0.0015919999, 0.000433398294, -0.999998569)
- Tool2.GripForward = Vector3.new(-0.00161359028, -0.000344417145, 0.999998569)
- Tool2.GripPos = Vector3.new(0, -0.349999994, -0.100000016)
- Tool2.GripRight = Vector3.new(-0.998458922, 0.0554737262, -0.0015919999)
- Tool2.GripUp = Vector3.new(0.0554731078, 0.998460174, 0.000433398294)
- Tool2.ToolTip = "Handgun"
- UnionOperation3.Name = "Handle"
- UnionOperation3.Parent = Tool2
- UnionOperation3.CFrame = CFrame.new(-4.87051725, 0.607330322, -38.0968056, -1.00000072, 1.05220526e-08, -5.9604659e-08, -1.05220526e-08, 1.00000024, 8.11945622e-09, -5.9604659e-08, -8.11945622e-09, -1.00000072)
- UnionOperation3.Orientation = Vector3.new(0, -180, 0)
- UnionOperation3.Position = Vector3.new(-4.87051725, 0.607330322, -38.0968056)
- UnionOperation3.Rotation = Vector3.new(-180, 0, -180)
- UnionOperation3.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
- UnionOperation3.Size = Vector3.new(0.218962356, 1.11467886, 1.54634953)
- UnionOperation3.BrickColor = BrickColor.new("Really black")
- UnionOperation3.Material = Enum.Material.SmoothPlastic
- UnionOperation3.Reflectance = 0.10000000149012
- UnionOperation3.brickColor = BrickColor.new("Really black")
- Sound4.Name = "EquipSound"
- Sound4.Parent = UnionOperation3
- Sound4.SoundId = "http://www.roblox.com/asset/?id=171140306"
- Sound4.Volume = 0.20000000298023
- Sound5.Name = "FireSound"
- Sound5.Parent = UnionOperation3
- Sound5.SoundId = "rbxassetid://143286342"
- Sound5.Volume = 1
- Sound6.Name = "Reload"
- Sound6.Parent = UnionOperation3
- Sound6.Pitch = 0.89999997615814
- Sound6.PlaybackSpeed = 0.89999997615814
- Sound6.SoundId = "http://www.roblox.com/asset/?id=174295321"
- Sound6.Volume = 1
- Sound7.Name = "Tick"
- Sound7.Parent = UnionOperation3
- Sound7.SoundId = "rbxassetid://154255000"
- Sound7.Volume = 1
- PointLight8.Name = "Flash"
- PointLight8.Parent = UnionOperation3
- PointLight8.Color = Color3.new(1, 0.568627, 0.192157)
- PointLight8.Enabled = false
- PointLight8.Shadows = true
- Smoke9.Parent = UnionOperation3
- Smoke9.Color = Color3.new(0.392157, 0.392157, 0.392157)
- Smoke9.Enabled = false
- Smoke9.Size = 0.10000000149012
- Smoke9.Opacity = 0.10000000149012
- Smoke9.RiseVelocity = 4
- Sound10.Name = "EquipSound2"
- Sound10.Parent = UnionOperation3
- Sound10.SoundId = "http://www.roblox.com/asset/?id=169310310"
- Sound10.Volume = 0.60000002384186
- Sound11.Name = "UnequipSound"
- Sound11.Parent = UnionOperation3
- Sound11.Pitch = 1.5
- Sound11.PlaybackSpeed = 1.5
- Sound11.SoundId = "http://www.roblox.com/asset/?id=169310310"
- Sound11.Volume = 0.30000001192093
- Animation12.Name = "Recoil"
- Animation12.Parent = Tool2
- Animation12.AnimationId = "http://www.roblox.com/Asset?ID=177443776"
- LocalScript13.Name = "HandgunScript"
- LocalScript13.Parent = Tool2
- table.insert(cors,sandbox(LocalScript13,function()
- --------------------- TEMPLATE WEAPON ---------------------------
- --edited by DestinyHarbinger
- -- Waits for the child of the specified parent
- local function WaitForChild(parent, childName)
- while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
- return parent[childName]
- end
- ----- TOOL DATA -----
- -- How much damage a bullet does
- local Damage = 18
- -- How many times per second the gun can fire
- local FireRate = 1 / 5.5
- -- The maximum distance the can can shoot, this value should never go above 1000
- local Range = 999
- -- In radians the minimum accuracy penalty
- local MinSpread = 0.005
- -- In radian the maximum accuracy penalty
- local MaxSpread = 0.07
- -- Number of bullets in a clip
- local ClipSize = 7
- -- DefaultValue for spare ammo
- local SpareAmmo = 999
- -- The amount the aim will increase or decrease by
- -- decreases this number reduces the speed that recoil takes effect
- local AimInaccuracyStepAmount = .5
- -- Time it takes to reload weapon
- local ReloadTime = 2.1
- ----------------------------------------
- -- Colors
- local FriendlyReticleColor = Color3.new(0, 1, 0)
- local EnemyReticleColor = Color3.new(1, 0, 0)
- local NeutralReticleColor = Color3.new(1, 1, 1)
- local Spread = MinSpread
- local AmmoInClip = ClipSize
- local Tool = script.Parent
- local Handle = WaitForChild(Tool, 'Handle')
- local WeaponGui = nil
- local LeftButtonDown
- local Reloading = false
- local IsShooting = false
- local Pitch = script.Parent.Handle.FireSound
- -- Player specific convenience variables
- local MyPlayer = nil
- local MyCharacter = nil
- local MyHumanoid = nil
- local MyTorso = nil
- local MyMouse = nil
- local RecoilAnim
- local RecoilTrack = nil
- local ReloadAnim
- local ReloadTrack = nil
- local IconURL = Tool.TextureId
- local DebrisService = game:GetService('Debris')
- local PlayersService = game:GetService('Players')
- local FireSound
- local OnFireConnection = nil
- local OnReloadConnection = nil
- local DecreasedAimLastShot = false
- local LastSpreadUpdate = time()
- local flare = script.Parent:WaitForChild("Flare")
- -- this is a dummy object that holds the flash made when the gun is fired
- local FlashHolder = nil
- local WorldToCellFunction = Workspace.Terrain.WorldToCellPreferSolid
- local GetCellFunction = Workspace.Terrain.GetCell
- function RayIgnoreCheck(hit, pos)
- if hit then
- if hit.Transparency >= 1 or string.lower(hit.Name) == "water" or
- hit.Name == "Effect" or hit.Name == "Rocket" or hit.Name == "Bullet" or
- hit.Name == "Handle" or hit:IsDescendantOf(MyCharacter) then
- return true
- elseif hit:IsA('Terrain') and pos then
- local cellPos = WorldToCellFunction(Workspace.Terrain, pos)
- if cellPos then
- local cellMat = GetCellFunction(Workspace.Terrain, cellPos.x, cellPos.y, cellPos.z)
- if cellMat and cellMat == Enum.CellMaterial.Water then
- return true
- end
- end
- end
- end
- return false
- end
- -- @preconditions: vec should be a unit vector, and 0 < rayLength <= 1000
- function RayCast(startPos, vec, rayLength)
- local hitObject, hitPos = game.Workspace:FindPartOnRay(Ray.new(startPos + (vec * .01), vec * rayLength), Handle)
- if hitObject and hitPos then
- local distance = rayLength - (hitPos - startPos).magnitude
- if RayIgnoreCheck(hitObject, hitPos) and distance > 0 then
- -- there is a chance here for potential infinite recursion
- return RayCast(hitPos, vec, distance)
- end
- end
- return hitObject, hitPos
- end
- function TagHumanoid(humanoid, player)
- -- Add more tags here to customize what tags are available.
- while humanoid:FindFirstChild('creator') do
- humanoid:FindFirstChild('creator'):Destroy()
- end
- local creatorTag = Instance.new("ObjectValue")
- creatorTag.Value = player
- creatorTag.Name = "creator"
- creatorTag.Parent = humanoid
- DebrisService:AddItem(creatorTag, 1.5)
- local weaponIconTag = Instance.new("StringValue")
- weaponIconTag.Value = IconURL
- weaponIconTag.Name = "icon"
- weaponIconTag.Parent = creatorTag
- end
- local function CreateBullet(bulletPos)
- local bullet = Instance.new('Part', Workspace)
- bullet.FormFactor = Enum.FormFactor.Custom
- bullet.Size = Vector3.new(0.1, 0.1, 0.1)
- bullet.BrickColor = BrickColor.new("Black")
- bullet.Shape = Enum.PartType.Block
- bullet.CanCollide = false
- bullet.CFrame = CFrame.new(bulletPos)
- bullet.Anchored = true
- bullet.TopSurface = Enum.SurfaceType.Smooth
- bullet.BottomSurface = Enum.SurfaceType.Smooth
- bullet.Name = 'Bullet'
- DebrisService:AddItem(bullet, 2.5)
- local shell = Instance.new("Part")
- shell.CFrame = Tool.Handle.CFrame * CFrame.fromEulerAnglesXYZ(1.5,0,0)
- shell.Size = Vector3.new(1,1,1)
- shell.BrickColor = BrickColor.new(226)
- shell.Parent = game.Workspace
- shell.CFrame = script.Parent.Handle.CFrame
- shell.CanCollide = false
- shell.Transparency = 0
- shell.BottomSurface = 0
- shell.TopSurface = 0
- shell.Name = "Shell"
- shell.Velocity = Tool.Handle.CFrame.lookVector * 35 + Vector3.new(math.random(-10,10),20,math.random(-10,20))
- shell.RotVelocity = Vector3.new(0,200,0)
- DebrisService:AddItem(shell, 1)
- local shellmesh = Instance.new("SpecialMesh")
- shellmesh.Scale = Vector3.new(.15,.4,.15)
- shellmesh.Parent = shell
- return bullet
- end
- local function Reload()
- if not Reloading then
- Reloading = true
- -- Don't reload if you are already full or have no extra ammo
- if AmmoInClip ~= ClipSize and SpareAmmo > 0 then
- if RecoilTrack then
- RecoilTrack:Stop()
- end
- if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then
- if WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
- WeaponGui.Crosshair.ReloadingLabel.Visible = true
- end
- end
- if ReloadTrack then
- ReloadTrack:Play()
- end
- script.Parent.Handle.Reload:Play()
- wait(ReloadTime)
- -- Only use as much ammo as you have
- local ammoToUse = math.min(ClipSize - AmmoInClip, SpareAmmo)
- AmmoInClip = AmmoInClip + ammoToUse
- SpareAmmo = SpareAmmo - ammoToUse
- UpdateAmmo(AmmoInClip)
- --WeaponGui.Reload.Visible = false
- if ReloadTrack then
- ReloadTrack:Stop()
- end
- end
- Reloading = false
- end
- end
- function OnFire()
- if IsShooting then return end
- if MyHumanoid and MyHumanoid.Health > 0 then
- if RecoilTrack and AmmoInClip > 0 then
- RecoilTrack:Play()
- end
- IsShooting = true
- while LeftButtonDown and AmmoInClip > 0 and not Reloading do
- if Spread and not DecreasedAimLastShot then
- Spread = math.min(MaxSpread, Spread + AimInaccuracyStepAmount)
- UpdateCrosshair(Spread)
- end
- DecreasedAimLastShot = not DecreasedAimLastShot
- if Handle:FindFirstChild('FireSound') then
- Pitch.Pitch = .8 + (math.random() * .5)
- Handle.FireSound:Play()
- Handle.Flash.Enabled = true
- flare.MuzzleFlash.Enabled = true
- --Handle.Smoke.Enabled=true --This is optional
- end
- if MyMouse then
- local targetPoint = MyMouse.Hit.p
- local shootDirection = (targetPoint - Handle.Position).unit
- -- Adjust the shoot direction randomly off by a little bit to account for recoil
- shootDirection = CFrame.Angles((0.5 - math.random()) * 2 * Spread,
- (0.5 - math.random()) * 2 * Spread,
- (0.5 - math.random()) * 2 * Spread) * shootDirection
- local hitObject, bulletPos = RayCast(Handle.Position, shootDirection, Range)
- local bullet
- -- Create a bullet here
- if hitObject then
- bullet = CreateBullet(bulletPos)
- end
- if hitObject and hitObject.Parent then
- local hitHumanoid = hitObject.Parent:FindFirstChild("Humanoid")
- if hitHumanoid then
- local hitPlayer = game.Players:GetPlayerFromCharacter(hitHumanoid.Parent)
- if MyPlayer.Neutral or (hitPlayer and hitPlayer.TeamColor ~= MyPlayer.TeamColor) then
- TagHumanoid(hitHumanoid, MyPlayer)
- hitHumanoid:TakeDamage(Damage)
- if bullet then
- bullet:Destroy()
- bullet = nil
- WeaponGui.Crosshair.Hit:Play()
- --bullet.Transparency = 1
- end
- Spawn(UpdateTargetHit)
- end
- end
- end
- AmmoInClip = AmmoInClip - 1
- UpdateAmmo(AmmoInClip)
- end
- wait(FireRate)
- end
- Handle.Flash.Enabled = false
- IsShooting = false
- flare.MuzzleFlash.Enabled = false
- --Handle.Smoke.Enabled=false --This is optional
- if AmmoInClip == 0 then
- Handle.Tick:Play()
- --WeaponGui.Reload.Visible = true
- Reload()
- end
- if RecoilTrack then
- RecoilTrack:Stop()
- end
- end
- end
- local TargetHits = 0
- function UpdateTargetHit()
- TargetHits = TargetHits + 1
- if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
- WeaponGui.Crosshair.TargetHitImage.Visible = true
- end
- wait(0.5)
- TargetHits = TargetHits - 1
- if TargetHits == 0 and WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
- WeaponGui.Crosshair.TargetHitImage.Visible = false
- end
- end
- function UpdateCrosshair(value, mouse)
- if WeaponGui then
- local absoluteY = 650
- WeaponGui.Crosshair:TweenSize(
- UDim2.new(0, value * absoluteY * 2 + 23, 0, value * absoluteY * 2 + 23),
- Enum.EasingDirection.Out,
- Enum.EasingStyle.Linear,
- 0.33)
- end
- end
- function UpdateAmmo(value)
- if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('ClipAmmo') then
- WeaponGui.AmmoHud.ClipAmmo.Text = AmmoInClip
- if value > 0 and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
- WeaponGui.Crosshair.ReloadingLabel.Visible = false
- end
- end
- if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('TotalAmmo') then
- WeaponGui.AmmoHud.TotalAmmo.Text = SpareAmmo
- end
- end
- function OnMouseDown()
- LeftButtonDown = true
- OnFire()
- end
- function OnMouseUp()
- LeftButtonDown = false
- end
- function OnKeyDown(key)
- if string.lower(key) == 'r' then
- Reload()
- if RecoilTrack then
- RecoilTrack:Stop()
- end
- end
- end
- function OnEquipped(mouse)
- Handle.EquipSound:Play()
- Handle.EquipSound2:Play()
- Handle.UnequipSound:Stop()
- RecoilAnim = WaitForChild(Tool, 'Recoil')
- ReloadAnim = WaitForChild(Tool, 'Reload')
- FireSound = WaitForChild(Handle, 'FireSound')
- MyCharacter = Tool.Parent
- MyPlayer = game:GetService('Players'):GetPlayerFromCharacter(MyCharacter)
- MyHumanoid = MyCharacter:FindFirstChild('Humanoid')
- MyTorso = MyCharacter:FindFirstChild('Torso')
- MyMouse = mouse
- WeaponGui = WaitForChild(Tool, 'WeaponHud'):Clone()
- if WeaponGui and MyPlayer then
- WeaponGui.Parent = MyPlayer.PlayerGui
- UpdateAmmo(AmmoInClip)
- end
- if RecoilAnim then
- RecoilTrack = MyHumanoid:LoadAnimation(RecoilAnim)
- end
- if ReloadAnim then
- ReloadTrack = MyHumanoid:LoadAnimation(ReloadAnim)
- end
- if MyMouse then
- -- Disable mouse icon
- MyMouse.Icon = "http://www.roblox.com/asset/?id=18662154"
- MyMouse.Button1Down:connect(OnMouseDown)
- MyMouse.Button1Up:connect(OnMouseUp)
- MyMouse.KeyDown:connect(OnKeyDown)
- end
- end
- -- Unequip logic here
- function OnUnequipped()
- Handle.UnequipSound:Play()
- Handle.EquipSound:Stop()
- Handle.EquipSound2:Stop()
- LeftButtonDown = false
- flare.MuzzleFlash.Enabled = false
- Reloading = false
- MyCharacter = nil
- MyHumanoid = nil
- MyTorso = nil
- MyPlayer = nil
- MyMouse = nil
- if OnFireConnection then
- OnFireConnection:disconnect()
- end
- if OnReloadConnection then
- OnReloadConnection:disconnect()
- end
- if FlashHolder then
- FlashHolder = nil
- end
- if WeaponGui then
- WeaponGui.Parent = nil
- WeaponGui = nil
- end
- if RecoilTrack then
- RecoilTrack:Stop()
- end
- if ReloadTrack then
- ReloadTrack:Stop()
- end
- end
- local function SetReticleColor(color)
- if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then
- for _, line in pairs(WeaponGui.Crosshair:GetChildren()) do
- if line:IsA('Frame') then
- line.BorderColor3 = color
- end
- end
- end
- end
- Tool.Equipped:connect(OnEquipped)
- Tool.Unequipped:connect(OnUnequipped)
- while true do
- wait(0.033)
- if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and MyMouse then
- WeaponGui.Crosshair.Position = UDim2.new(0, MyMouse.X, 0, MyMouse.Y)
- SetReticleColor(NeutralReticleColor)
- local target = MyMouse.Target
- if target and target.Parent then
- local player = PlayersService:GetPlayerFromCharacter(target.Parent)
- if player then
- if MyPlayer.Neutral or player.TeamColor ~= MyPlayer.TeamColor then
- SetReticleColor(EnemyReticleColor)
- else
- SetReticleColor(FriendlyReticleColor)
- end
- end
- end
- end
- if Spread and not IsShooting then
- local currTime = time()
- if currTime - LastSpreadUpdate > FireRate * 2 then
- LastSpreadUpdate = currTime
- Spread = math.max(MinSpread, Spread - AimInaccuracyStepAmount)
- UpdateCrosshair(Spread, MyMouse)
- end
- end
- end
- end))
- Script14.Name = "WeldingDoNotDelete"
- Script14.Parent = Tool2
- table.insert(cors,sandbox(Script14,function()
- --DO NOT DELETE, THIS WILL BREAK THE GUN
- function Stick(x, y)
- local W = Instance.new("Weld")
- W.Part0 = x
- W.Part1 = y
- local CJ = CFrame.new(x.Position)
- local C0 = x.CFrame:inverse()*CJ
- local C1 = y.CFrame:inverse()*CJ
- W.C0 = C0
- W.C1 = C1
- W.Parent = x
- end
- function Get(A)
- if A.ClassName == ("Part") then
- Stick(script.Parent.Handle, A)
- A.Anchored = false
- else
- local C = A:GetChildren()
- for i=1, #C do
- Get(C[i])
- end
- end
- end
- function Finale()
- Get(script.Parent)
- end
- script.Parent.Equipped:connect(Finale)
- script.Parent.Unequipped:connect(Finale)
- Finale()
- end))
- Part15.Name = "Flare"
- Part15.Parent = Tool2
- Part15.CFrame = CFrame.new(-4.87999678, 0.979990602, -39.1899796, 1.00000036, -2.40926101e-09, -1.1920929e-07, 1.29313085e-08, 1.00000012, -8.11945711e-09, 1.78813934e-07, 1.11022302e-15, 1.00000036)
- Part15.Position = Vector3.new(-4.87999678, 0.979990602, -39.1899796)
- Part15.Transparency = 1
- Part15.Size = Vector3.new(1, 1, 1)
- Part15.CanCollide = false
- Part15.FormFactor = Enum.FormFactor.Symmetric
- Part15.formFactor = Enum.FormFactor.Symmetric
- BillboardGui16.Name = "MuzzleFlash"
- BillboardGui16.Parent = Part15
- BillboardGui16.Enabled = false
- BillboardGui16.Size = UDim2.new(2, 0, 2, 0)
- ImageLabel17.Name = "Img"
- ImageLabel17.Parent = BillboardGui16
- ImageLabel17.Size = UDim2.new(1, 0, 1, 0)
- ImageLabel17.BackgroundTransparency = 1
- ImageLabel17.Image = "http://www.roblox.com/asset/?ID=103740493"
- Script18.Parent = ImageLabel17
- table.insert(cors,sandbox(Script18,function()
- local imgs = {103740493,103804266,103804383}
- for _,v in pairs(imgs) do
- game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?ID="..v)
- end
- script.Parent.Parent.Changed:connect(function ()
- if script.Parent.Parent.Enabled == true then
- wait(0.09)
- script.Parent.Parent.Enabled = false
- end
- end)
- while true do
- for i = 1,#imgs do
- script.Parent.Image = "http://www.roblox.com/asset/?ID="..imgs[i]
- wait(0.03)
- end
- end
- end))
- Animation19.Name = "Reload"
- Animation19.Parent = Tool2
- Animation19.AnimationId = "http://www.roblox.com/Asset?ID=95384819"
- Script20.Name = "Readme From Destiny"
- Script20.Parent = Tool2
- table.insert(cors,sandbox(Script20,function()
- --[[HANDGUN v1.2 CREATED BY DESTINYHARBINGER
- A fully working, non virus riddled, and decently realistic up to date handgun made from a Unioned Part
- made from solid modeling. This weapon is actually an edited Template Assualt Rifle you can see from those
- broken template games. Modified to become more modern and up to date.
- This weapon features:
- -Anti Teamkill
- -Flashes and Flares and Bears Oh My!
- -Reloading (WOWWWWWWW)
- -IOS and Android Compatibility (Tested and Approved)
- -No virus junk.
- -Animations (will improve later)
- -Easy to edit script!
- -Decent pistol sounds!
- -Non-laggy! Only 2 parts and thats it!
- -and not so much more because its just a regular gun!!!!!!!
- )))))))))IMPORTANT:
- DO NOT DELETE, UNUNION, OR CHANGE NAMES OF ANYTHING UNLESS YOU ARE AN EXPERT AT DOING THAT BUISNESS.
- TREAD CAREFULLY.
- ~PATCH NOTES~
- v1.2
- -Tool not working if in starterpack has been fixed by Luckymaxer.
- -Minor HUD changes.
- v1.1
- -Smoke is now disabled. Go through the handgun script and CTRL + F, search smoke, and uncomment the options
- for it to work again.
- -Shell casings have been added
- -When sucessfully hitting someone, a local sound is played to indicate a hit.
- -Works with mobile now. Thats right, you can now use it on iPhone Sean.
- -Changed Equipping sounds.
- ______ _____ _____ _____ _____ _ _ __ __
- | _ \| ___|/ ___||_ _||_ _|| \ | |\ \ / /
- | | | || |__ \ `--. | | | | | \| | \ V /
- | | | || __| `--. \ | | | | | . ` | \ /
- | |/ / | |___ /\__/ / | | _| |_ | |\ | | |
- |___/ \____/ \____/ \_/ \___/ \_| \_/ \_/
- _ _ ___ ______ ______ _____ _ _ _____ _____ ______
- | | | | / _ \ | ___ \| ___ \|_ _|| \ | || __ \| ___|| ___ \
- | |_| |/ /_\ \| |_/ /| |_/ / | | | \| || | \/| |__ | |_/ /
- | _ || _ || / | ___ \ | | | . ` || | __ | __| | /
- | | | || | | || |\ \ | |_/ / _| |_ | |\ || |_\ \| |___ | |\ \
- \_| |_/\_| |_/\_| \_|\____/ \___/ \_| \_/ \____/\____/ \_| \_|
- __ __ _____ _____ _____ ______ _____ _____ __ _____
- / / \ \ / __ \| _ || _ ||___ / / __ \| _ |/ | | ___|
- | | ___ | | `' / /'| |/' || |/' | / /______`' / /'| |/' |`| | |___ \
- | | / __|| | / / | /| || /| | / /|______| / / | /| | | | \ \
- | || (__ | | ./ /___\ |_/ /\ |_/ /./ / ./ /___\ |_/ /_| |_/\__/ /
- | | \___|| | \_____/ \___/ \___/ \_/ \_____/ \___/ \___/\____/
- \_\ /_/
- If you can, leave me some credit k ;)
- ]]
- end))
- Camera21.Name = "ThumbnailCamera"
- Camera21.Parent = Tool2
- Camera21.CFrame = CFrame.new(-7.073627, 1.91333532, -40.2050323, -0.684124351, 0.268417299, -0.678178549, 1.49011612e-08, 0.929820061, 0.368014812, 0.729365468, 0.251767904, -0.636112452)
- Camera21.CoordinateFrame = CFrame.new(-7.073627, 1.91333532, -40.2050323, -0.684124351, 0.268417299, -0.678178549, 1.49011612e-08, 0.929820061, 0.368014812, 0.729365468, 0.251767904, -0.636112452)
- Camera21.FieldOfView = 25.000000418326
- Camera21.Focus = CFrame.new(-5.71727037, 1.17730594, -38.9328079, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Camera21.focus = CFrame.new(-5.71727037, 1.17730594, -38.9328079, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- ScreenGui22.Name = "WeaponHud"
- ScreenGui22.Parent = Tool2
- Frame23.Name = "AmmoHud"
- Frame23.Parent = ScreenGui22
- Frame23.Position = UDim2.new(1, -265, 1, -60)
- Frame23.Size = UDim2.new(0, 200, 0, 50)
- Frame23.BackgroundTransparency = 1
- Frame23.BorderSizePixel = 0
- TextLabel24.Name = "ForwardSlash"
- TextLabel24.Parent = Frame23
- TextLabel24.Position = UDim2.new(0.5, 0, 0.5, 0)
- TextLabel24.BackgroundTransparency = 1
- TextLabel24.BorderSizePixel = 0
- TextLabel24.Font = Enum.Font.SourceSans
- TextLabel24.FontSize = Enum.FontSize.Size24
- TextLabel24.Text = "/"
- TextLabel24.TextColor = BrickColor.new("Institutional white")
- TextLabel24.TextColor3 = Color3.new(1, 1, 1)
- TextLabel24.TextScaled = true
- TextLabel24.TextSize = 24
- TextLabel24.TextStrokeTransparency = 0
- TextLabel24.TextWrap = true
- TextLabel24.TextWrapped = true
- TextLabel25.Name = "ClipAmmo"
- TextLabel25.Parent = Frame23
- TextLabel25.Position = UDim2.new(0.449999988, 0, 0.5, 0)
- TextLabel25.BackgroundTransparency = 1
- TextLabel25.BorderSizePixel = 0
- TextLabel25.Font = Enum.Font.SourceSansBold
- TextLabel25.FontSize = Enum.FontSize.Size24
- TextLabel25.Text = "54"
- TextLabel25.TextColor = BrickColor.new("Institutional white")
- TextLabel25.TextColor3 = Color3.new(1, 1, 1)
- TextLabel25.TextScaled = true
- TextLabel25.TextSize = 24
- TextLabel25.TextStrokeTransparency = 0
- TextLabel25.TextWrap = true
- TextLabel25.TextWrapped = true
- TextLabel25.TextXAlignment = Enum.TextXAlignment.Right
- TextLabel26.Name = "TotalAmmo"
- TextLabel26.Parent = Frame23
- TextLabel26.Position = UDim2.new(0.550000012, 0, 0.5, 0)
- TextLabel26.BackgroundTransparency = 1
- TextLabel26.BorderSizePixel = 0
- TextLabel26.Font = Enum.Font.SourceSans
- TextLabel26.FontSize = Enum.FontSize.Size24
- TextLabel26.Text = "180"
- TextLabel26.TextColor = BrickColor.new("Institutional white")
- TextLabel26.TextColor3 = Color3.new(1, 1, 1)
- TextLabel26.TextScaled = true
- TextLabel26.TextSize = 24
- TextLabel26.TextStrokeTransparency = 0
- TextLabel26.TextWrap = true
- TextLabel26.TextWrapped = true
- TextLabel26.TextXAlignment = Enum.TextXAlignment.Left
- ImageLabel27.Parent = Frame23
- ImageLabel27.Size = UDim2.new(0, 200, 0, 50)
- ImageLabel27.BackgroundColor = BrickColor.new("Institutional white")
- ImageLabel27.BackgroundColor3 = Color3.new(1, 1, 1)
- ImageLabel27.BackgroundTransparency = 1
- ImageLabel27.BorderColor = BrickColor.new("Really black")
- ImageLabel27.BorderColor3 = Color3.new(0, 0, 0)
- ImageLabel27.BorderSizePixel = 0
- ImageLabel27.Image = "rbxassetid://51219827"
- ImageLabel27.ImageColor3 = Color3.new(0.352941, 0.352941, 0.352941)
- ImageLabel27.ImageTransparency = 0.20000000298023
- Frame28.Name = "Crosshair"
- Frame28.Parent = ScreenGui22
- Frame28.Position = UDim2.new(0, 500, 0, 500)
- Frame28.Size = UDim2.new(0, 150, 0, 150)
- Frame28.BackgroundColor = BrickColor.new("Lime green")
- Frame28.BackgroundColor3 = Color3.new(0, 1, 0)
- Frame28.BackgroundTransparency = 1
- Frame28.BorderSizePixel = 0
- Frame29.Name = "TopFrame"
- Frame29.Parent = Frame28
- Frame29.Position = UDim2.new(0, -1, -0.5, -7)
- Frame29.Size = UDim2.new(0, 2, 0, 14)
- Frame29.BackgroundColor = BrickColor.new("Really black")
- Frame29.BackgroundColor3 = Color3.new(0, 0, 0)
- Frame29.BorderColor = BrickColor.new("Institutional white")
- Frame29.BorderColor3 = Color3.new(1, 1, 1)
- Frame30.Name = "RightFrame"
- Frame30.Parent = Frame28
- Frame30.Position = UDim2.new(0.5, -7, 0, -1)
- Frame30.Size = UDim2.new(0, 14, 0, 2)
- Frame30.BackgroundColor = BrickColor.new("Really black")
- Frame30.BackgroundColor3 = Color3.new(0, 0, 0)
- Frame30.BorderColor = BrickColor.new("Institutional white")
- Frame30.BorderColor3 = Color3.new(1, 1, 1)
- Frame31.Name = "LeftFrame"
- Frame31.Parent = Frame28
- Frame31.Position = UDim2.new(-0.5, -7, 0, -1)
- Frame31.Size = UDim2.new(0, 14, 0, 2)
- Frame31.BackgroundColor = BrickColor.new("Really black")
- Frame31.BackgroundColor3 = Color3.new(0, 0, 0)
- Frame31.BorderColor = BrickColor.new("Institutional white")
- Frame31.BorderColor3 = Color3.new(1, 1, 1)
- ImageLabel32.Name = "TargetHitImage"
- ImageLabel32.Parent = Frame28
- ImageLabel32.Position = UDim2.new(0, -25, 0, -25)
- ImageLabel32.Visible = false
- ImageLabel32.Size = UDim2.new(0, 50, 0, 50)
- ImageLabel32.BackgroundTransparency = 1
- ImageLabel32.BorderSizePixel = 0
- ImageLabel32.Image = "http://www.roblox.com/asset/?id=115400215"
- TextLabel33.Name = "ReloadingLabel"
- TextLabel33.Parent = Frame28
- TextLabel33.Position = UDim2.new(0, 20, 0, -20)
- TextLabel33.Visible = false
- TextLabel33.BackgroundTransparency = 1
- TextLabel33.BorderSizePixel = 0
- TextLabel33.Font = Enum.Font.ArialBold
- TextLabel33.FontSize = Enum.FontSize.Size18
- TextLabel33.Text = "Reloading"
- TextLabel33.TextColor = BrickColor.new("Crimson")
- TextLabel33.TextColor3 = Color3.new(0.568627, 0, 0)
- TextLabel33.TextSize = 18
- TextLabel33.TextStrokeTransparency = 0
- TextLabel33.TextXAlignment = Enum.TextXAlignment.Left
- TextLabel33.TextYAlignment = Enum.TextYAlignment.Bottom
- Frame34.Name = "BottomFrame"
- Frame34.Parent = Frame28
- Frame34.Position = UDim2.new(0, -1, 0.5, -7)
- Frame34.Size = UDim2.new(0, 2, 0, 14)
- Frame34.BackgroundColor = BrickColor.new("Really black")
- Frame34.BackgroundColor3 = Color3.new(0, 0, 0)
- Frame34.BorderColor = BrickColor.new("Institutional white")
- Frame34.BorderColor3 = Color3.new(1, 1, 1)
- Sound35.Name = "Hit"
- Sound35.Parent = Frame28
- Sound35.SoundId = "rbxassetid://160432334"
- Sound35.Volume = 1
- Script36.Parent = Tool2
- table.insert(cors,sandbox(Script36,function()
- gear.Parent = Player.Character
- end))
- Script37.Parent = mas
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = workspace
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement