I'm New At Script But, I Was Making The Gun Script With Youtube Tutorial, And Realized When I Testing Gun With My Friend, I Hear The Shoot Sound, But The Friend Can't Hear The Sound, When Friend Shoot, I Don't Hear It., I Did Disable Some Other Script, But It Doesn't Worked.
local gun = script.Parent
local firesound = gun:WaitForChild("Handle").Shoot
local equipsound = gun.Handle.Equip
local emptysound = gun.Handle.ClipEmpty
local reloadsound = gun.Handle.Reload
local player = game.Players.LocalPlayer
local clipsize = gun:WaitForChild("Ammo").Value
local ammo = gun:WaitForChild("Ammo")
local chara = player.Character or player.CharacterAdded:Wait()
local hum = chara:WaitForChild("Humanoid")
local userInput = game:GetService("UserInputService")
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.Icon = "rbxassetid://4727564972"
local replicatedstorage = game:GetService('ReplicatedStorage')
local event = replicatedstorage:WaitForChild('PistolFire')
gun.Equipped:Connect(function(mouse)
local anim2 = hum:LoadAnimation(script.Parent.Equip)
local current2 = anim2
current2:Play()
equipsound:Play()
player.PlayerGui.AmmoGui.Ammo.Visible = true
player.PlayerGui.AmmoGui.Ammo.Text = "Ammo: " .. tostring(ammo.Value) .. " / " .. gun.MaxAmmo.Value
mouse.Button1Down:Connect(function()
if gun.Ammo.Value > 0 then
event:FireServer(gun.Handle.Position, gun.Handle.Orientation, mouse.Hit.p)
firesound:Play()
local anim = hum:LoadAnimation(script.Parent.Animation)
local current = anim
current:Play()
gun.Ammo.Value = gun.Ammo.Value - 1
else
emptysound:Play()
end
end)
mouse.Button2Down:Connect(function()
local camera = game.Workspace.CurrentCamera
camera.FieldOfView = 40
end)
mouse.Button2Up:Connect(function()
local camera = game.Workspace.CurrentCamera
camera.FieldOfView = 70
end)
end)
gun.Unequipped:Connect(function()
player.PlayerGui.AmmoGui.Ammo.Visible = false
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
if gun.Ammo.Value < clipsize and gun.MaxAmmo.Value > 0 then
reloadsound:Play()
local anim3 = hum:LoadAnimation(script.Parent.Reload)
local current3 = anim3
current3:Play()
reloadsound.Ended:Wait()
if gun.MaxAmmo.Value - (clipsize - gun.Ammo.Value) >= 0 then
gun.MaxAmmo.Value = gun.MaxAmmo.Value - (clipsize - gun.Ammo.Value)
gun.Ammo.Value = clipsize
else
gun.Ammo.Value = gun.Ammo.Value + gun.MaxAmmo.Value
gun.MaxAmmo.Value = 0
player.PlayerGui.AmmoGui.Ammo.Text = "Ammo: " .. tostring(ammo.Value) .. " / " .. gun.MaxAmmo.Value
end
end
end
end
end
end)
ammo.Changed:Connect(function()
player.PlayerGui.AmmoGui.Ammo.Text = "Ammo: " .. tostring(ammo.Value) .. " / " .. gun.MaxAmmo.Value
end)

2 comments
Thanks You For Teaching Me This Kindfully! :D
Its better to use a serverscript to handle tools because exploiters can spam the remote unless there is a debounce on the server