Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tool = script.Parent
- local player = game.Players.LocalPlayer
- local character = player.Character
- local mouse = player:GetMouse()
- local reloading = false
- local difference = 0
- local replicatedstorage = game:GetService("ReplicatedStorage")
- --local gungui = tool:WaitForChild("GunGUI")
- local bullets = tool:WaitForChild("Bullets")
- local reloadtime = 3
- --Reloading:
- function reload()
- reloading = true
- mouse.Icon = "http://www.roblox.com/asset?id=936489163"
- --player.PlayerGui:WaitForChild("GunGUI").Bullets.Text = "Reloading!"
- wait(2.5)
- bullets.Value = 6 --BEWARE OF THIS (it was originally adding 6 to bullets.Value .It got changed cuz it added too many bullets.)
- --player.PlayerGui:WaitForChild("GunGUI").Bullets.Text = "Bullets: "..bullets.Value
- mouse.Icon = "http://www.roblox.com/asset?id=936803874"
- --equipAnimation:FireServer(tool.shoot)
- reloading = false
- end
- tool.Equipped:Connect(function(mouse)
- --gungui:Clone().Parent = player.PlayerGui -- We are cloning the Gun GUI into the player's PlayerGUI
- --findBodyType() -- Calling the function above to check the body type.
- --equipAnimation:FireServer(tool.shoot) -- Calling the equip animation remoteevent so that the server can play the animation
- mouse.Icon = "http://www.roblox.com/asset?id=936803874"
- mouse.Button1Down:Connect(function()
- if reloading == false then
- if bullets.Value > 0 then
- print("shoot working")
- bullets.Value = bullets.Value - 1
- else
- print("reload working")
- reload()
- print("Bullets: ")
- print(bullets.Value)
- end
- end
- end)
- tool.Unequipped:Connect(function()
- mouse.Icon = ""
- --unequipanimation:FireServer(tool.shoot)
- --player.PlayerGui.GunGUI:Destroy()
- --contextActionService:UnbindAction("ReloadBtn")
- end)
- end)
Advertisement
Advertisement