Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Player = game.Players.LocalPlayer
- local Character = Player.Character or Player.CharacterAdded:Wait()
- local Humanoid = Character:WaitForChild("Humanoid")
- local root = Character:WaitForChild("HumanoidRootPart")
- local Input = game:GetService("UserInputService")
- local gui = script.Parent:WaitForChild("GunGui")
- local debounce = true
- local shooterName
- while Character.Parent == nil do
- Character.AncestryChanged:wait()
- end
- if Character:FindFirstChild("Humanoid") then
- local animation = Humanoid:LoadAnimation(script:WaitForChild("NormalAnim"))
- local sprintAnimation = Humanoid:LoadAnimation(script:WaitForChild("RunAnim"))
- local reloadAnimation = Humanoid:LoadAnimation(script:WaitForChild("ReloadAnim"))
- script.Parent.Equipped:connect(function()
- if Character:FindFirstChild("Humanoid") then
- animation = Humanoid:LoadAnimation(script:WaitForChild("NormalAnim"))
- sprintAnimation = Humanoid:LoadAnimation(script:WaitForChild("RunAnim"))
- reloadAnimation = Humanoid:LoadAnimation(script:WaitForChild("ReloadAnim"))
- script.Parent.Select:Play()
- animation:Play()
- sprintAnimation:Stop()
- script.Parent.RTShoot.Value = true
- script.Parent.Sprinting.Value = false
- script.Parent.IsEquipped.Value = true
- end
- end)
- script.Parent.Unequipped:connect(function()
- if Character:FindFirstChild("Humanoid") then
- script.Parent.Empty:Play()
- animation:Stop()
- sprintAnimation:Stop()
- script.Parent.RTShoot.Value = true
- script.Parent.Sprinting.Value = false
- script.Parent.IsEquipped.Value = false
- Humanoid.WalkSpeed = 16
- end
- end)
- script.Parent.Activated:connect(function()
- if script.Parent.Rounds.Value >= 1 then else return end
- if script.Parent.Reloading.Value == true then return end
- local shooterName = Player.Name
- if debounce == true then
- if script.Parent.Sprinting.Value == false then
- debounce = false
- script.Parent.Rounds.Value = script.Parent.Rounds.Value - 1
- script.Parent.ShootEvent:FireServer(Player:GetMouse().Hit.LookVector, shooterName)
- wait(.25)
- Character:WaitForChild("Humanoid").WalkSpeed = 16
- debounce = true
- end
- end
- end)
- Input.InputBegan:Connect(function(Key,GameProcessed)
- if GameProcessed then return end
- if Character:FindFirstChild("Humanoid") then
- if Key.KeyCode == Enum.KeyCode.R then
- if script.Parent.Rounds.Value <= 12 then
- if script.Parent.IsEquipped.Value == true then
- if script.Parent.Reloading.Value == false then
- script.Parent.Reloading.Value = true
- animation:Stop()
- sprintAnimation:Stop()
- reloadAnimation:Play()
- wait(2)
- animation:Play()
- reloadAnimation:Stop()
- script.Parent.Reloading.Value = false
- script.Parent.Rounds.Value = 13
- end
- end
- end
- elseif Key.KeyCode == Enum.KeyCode.LeftShift then
- if script.Parent.IsEquipped.Value == true then
- if script.Parent.RTShoot.Value == true and script.Parent.Reloading.Value == false and script.Parent.Sprinting.Value == false then
- animation:Stop()
- sprintAnimation:Play()
- script.Parent.RTShoot.Value = false
- script.Parent.Sprinting.Value = true
- Humanoid.WalkSpeed = 32
- else
- animation:Play()
- sprintAnimation:Stop()
- script.Parent.RTShoot.Value = true
- script.Parent.Sprinting.Value = false
- Humanoid.WalkSpeed = 16
- end
- end
- end
- end
- end)
- while wait() do
- game:GetService("ServerStorage"):WaitForChild("ShooterName").Value = shooterName
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement