local gun = script.Parent
local gun_shot = gun.Handle.Shoot
local empty_sound = gun.Handle.Empty
local reload_sound = gun.Handle.Reload
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local remoteEvent = ReplicatedStorage:WaitForChild('ShotEvent')
local userInput = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild('ShotEvent')
gun.Equipped:Connect(function(mouse)
mouse.Button1Down:Connect(function()
if gun.Ammo.Value > 0 then
remoteEvent:FireServer(gun.Handle.Position, mouse.Hit.p)
gun_shot:Play()
gun.Ammo.Value = gun.Ammo.Value - 1
else
empty_sound:Play()
end
end)
end)
userInput.InputBegan:Connect(function(input, gameProcessed)
if not gameProcessed then
if input.UserInputType == Enum.UserInputType.Keyboard then
local keycode = input.KeyCode
if keycode == Enum.KeyCode.R then
reload_sound:Play()
reload_sound.Ended:Wait()
gun.Ammo.Value = 15
end
end
end
end)
help pls
