Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --SynapseX Decompiler
- gun = nil
- equipped = false
- ready = true
- jumping = false
- GUI = script.Parent
- aiming = false
- reloads = {
- true,
- true,
- true,
- true,
- true
- }
- rlt = 0
- local nCC = 0
- local CC = script.Parent:GetChildren()
- for cc = 1, #CC do
- if CC[cc].Name == "GunScript" then
- nCC = nCC + 1
- end
- end
- if script.Parent.Name ~= "GameGui" or nCC > 1 or script.Name ~= "GunScript" then
- script:Destroy()
- end
- game.ReplicatedStorage.RemoteFunctionz.Items.EquipGun.OnClientEvent:connect(function(bool)
- if bool then
- equipped = true
- gun = bool
- reloading = false
- script.Parent.WeaponButtons.Attack1.Text = "Aim"
- script.Parent.WeaponButtons.Attack2.Text = "Fire"
- script.Parent.WeaponButtons.Attack2.Visible = false
- if script.Parent.OnMobile.Value then
- script.Parent.WeaponButtons.Visible = true
- end
- elseif equipped then
- equipped = false
- gun = nil
- game:GetService("UserInputService").MouseIconEnabled = true
- script.Parent.Crosshairs.Visible = false
- game.Players.LocalPlayer.CameraMode = Enum.CameraMode.Classic
- aiming = false
- script.Parent.WeaponButtons.Visible = false
- script.Parent.FLM:Fire(1)
- end
- end)
- wait(5)
- MOUSE = game.Players.LocalPlayer:GetMouse()
- function Reload()
- reloading = true
- rlt = rlt + 1
- local rltime = rlt
- local oslot = gun.Slot.Value
- if game.Players:FindFirstChild("Nahr_Nahrstein") and gun and gun:findFirstChild("ReloadOverride") then
- if gun and gun.Slot.Value == oslot and rlt == rltime then
- reloads[gun.Slot.Value] = true
- reloading = false
- if gun:findFirstChild("Bolt") then
- gun.Bolt.Transparency = 0
- end
- end
- else
- if gun then
- script.Parent.FLM:Fire(0.5)
- game.ReplicatedStorage.RemoteFunctionz.Gear.Animation:FireServer(gun.AimAnim, gun.ReloadAnim, gun.Flash.Reload)
- end
- wait(6)
- if gun and gun.Slot.Value == oslot and rlt == rltime then
- script.Parent.FLM:Fire(1)
- reloads[gun.Slot.Value] = true
- game.ReplicatedStorage.RemoteFunctionz.Gear.Animation:FireServer(nil, gun.GearIdleAnim)
- reloading = false
- if gun:findFirstChild("Bolt") then
- gun.Bolt.Transparency = 0
- end
- end
- end
- end
- game:GetService("UserInputService").InputBegan:connect(function(input, b)
- if not equipped or not ready then
- return
- end
- local code = input.KeyCode
- if input.UserInputType == Enum.UserInputType.MouseButton1 and reloads[gun.Slot.Value] and aiming and game.Players.LocalPlayer.Character.HumanoidRootPart.Position.Y > 1.5 then
- ready = false
- game.ReplicatedStorage.RemoteFunctionz.Ships.FireGun:FireServer(game.Players.LocalPlayer.Character:findFirstChild("ActiveGear"), workspace.CurrentCamera.CFrame.p + workspace.CurrentCamera.CFrame.lookVector * 100)
- aiming = false
- game:GetService("UserInputService").MouseIconEnabled = true
- script.Parent.Crosshairs.Visible = false
- game.Players.LocalPlayer.CameraMode = Enum.CameraMode.Classic
- reloads[gun.Slot.Value] = false
- if gun:findFirstChild("Bolt") then
- gun.Bolt.Transparency = 1
- end
- if game.Players:FindFirstChild("Nahr_Nahrstein") and gun and gun:findFirstChild("ReloadOverride") then
- wait(0.15)
- aiming = true
- else
- wait(1)
- end
- ready = true
- Reload()
- elseif input.UserInputType == Enum.UserInputType.MouseButton2 then
- if reloads[gun.Slot.Value] then
- ready = false
- aiming = true
- script.Parent.FLM:Fire(0.5)
- game:GetService("UserInputService").MouseIconEnabled = false
- script.Parent.Crosshairs.Visible = true
- game.Players.LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson
- if gun.Flash:findFirstChild("Click") then
- game.ReplicatedStorage.RemoteFunctionz.Gear.Animation:FireServer(gun.GearIdleAnim, gun.AimAnim, gun.Flash.Click)
- else
- game.ReplicatedStorage.RemoteFunctionz.Gear.Animation:FireServer(gun.GearIdleAnim, gun.AimAnim)
- end
- wait(0.3)
- ready = true
- elseif not reloading then
- Reload()
- end
- elseif code == Enum.KeyCode.F then
- if aiming then
- ready = false
- aiming = false
- script.Parent.FLM:Fire(1)
- game:GetService("UserInputService").MouseIconEnabled = true
- script.Parent.Crosshairs.Visible = false
- game.ReplicatedStorage.RemoteFunctionz.Gear.Animation:FireServer(gun.AimAnim, gun.GearIdleAnim)
- game.Players.LocalPlayer.CameraMode = Enum.CameraMode.Classic
- wait(0.15)
- ready = true
- elseif reloads[gun.Slot.Value] then
- ready = false
- aiming = true
- script.Parent.FLM:Fire(0.5)
- game:GetService("UserInputService").MouseIconEnabled = false
- script.Parent.Crosshairs.Visible = true
- game.Players.LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson
- if gun.Flash:findFirstChild("Click") then
- game.ReplicatedStorage.RemoteFunctionz.Gear.Animation:FireServer(gun.GearIdleAnim, gun.AimAnim, gun.Flash.Click)
- else
- game.ReplicatedStorage.RemoteFunctionz.Gear.Animation:FireServer(gun.GearIdleAnim, gun.AimAnim)
- end
- wait(0.15)
- ready = true
- elseif not reloading then
- Reload()
- end
- end
- end)
- game:GetService("UserInputService").InputEnded:connect(function(input, b)
- if not equipped then
- return
- end
- local code = input.KeyCode
- if input.UserInputType == Enum.UserInputType.MouseButton2 and aiming then
- ready = false
- aiming = false
- script.Parent.FLM:Fire(1)
- game:GetService("UserInputService").MouseIconEnabled = true
- script.Parent.Crosshairs.Visible = false
- game.ReplicatedStorage.RemoteFunctionz.Gear.Animation:FireServer(gun.AimAnim, gun.GearIdleAnim)
- game.Players.LocalPlayer.CameraMode = Enum.CameraMode.Classic
- wait(0.15)
- ready = true
- end
- end)
- script.Parent.WeaponButtons.Attack1.MouseButton1Down:connect(function()
- if not gun then
- return
- end
- if aiming then
- ready = false
- aiming = false
- script.Parent.WeaponButtons.Attack2.Visible = false
- script.Parent.FLM:Fire(1)
- game:GetService("UserInputService").MouseIconEnabled = true
- script.Parent.Crosshairs.Visible = false
- game.ReplicatedStorage.RemoteFunctionz.Gear.Animation:FireServer(gun.AimAnim, gun.GearIdleAnim)
- game.Players.LocalPlayer.CameraMode = Enum.CameraMode.Classic
- wait(0.15)
- ready = true
- elseif reloads[gun.Slot.Value] then
- ready = false
- aiming = true
- script.Parent.WeaponButtons.Attack2.Visible = true
- script.Parent.FLM:Fire(0.5)
- game:GetService("UserInputService").MouseIconEnabled = false
- script.Parent.Crosshairs.Visible = true
- game.Players.LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson
- if gun.Flash:findFirstChild("Click") then
- game.ReplicatedStorage.RemoteFunctionz.Gear.Animation:FireServer(gun.GearIdleAnim, gun.AimAnim, gun.Flash.Click)
- else
- game.ReplicatedStorage.RemoteFunctionz.Gear.Animation:FireServer(gun.GearIdleAnim, gun.AimAnim)
- end
- wait(0.15)
- ready = true
- elseif not reloading then
- Reload()
- end
- end)
- script.Parent.WeaponButtons.Attack2.MouseButton1Down:connect(function()
- if not equipped or not aiming then
- return
- end
- if reloads[gun.Slot.Value] and aiming and game.Players.LocalPlayer.Character.HumanoidRootPart.Position.Y > 1.5 then
- ready = false
- game.ReplicatedStorage.RemoteFunctionz.Ships.FireGun:FireServer(game.Players.LocalPlayer.Character:findFirstChild("ActiveGear"), workspace.CurrentCamera.CFrame.p + workspace.CurrentCamera.CFrame.lookVector * 100)
- aiming = false
- game:GetService("UserInputService").MouseIconEnabled = true
- script.Parent.Crosshairs.Visible = false
- game.Players.LocalPlayer.CameraMode = Enum.CameraMode.Classic
- reloads[gun.Slot.Value] = false
- if gun:findFirstChild("Bolt") then
- gun.Bolt.Transparency = 1
- end
- script.Parent.WeaponButtons.Attack2.Visible = false
- wait(1)
- ready = true
- Reload()
- end
- end)
Add Comment
Please, Sign In to add comment