Can Someone Help Me?, I Need Help With The Sounds! (Bad English, Sorry)
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.
01 | local gun = script.Parent |
02 | local firesound = gun:WaitForChild( "Handle" ).Shoot |
03 | local equipsound = gun.Handle.Equip |
04 | local emptysound = gun.Handle.ClipEmpty |
05 | local reloadsound = gun.Handle.Reload |
06 | local player = game.Players.LocalPlayer |
07 | local clipsize = gun:WaitForChild( "Ammo" ).Value |
08 | local ammo = gun:WaitForChild( "Ammo" ) |
09 | local chara = player.Character or player.CharacterAdded:Wait() |
10 | local hum = chara:WaitForChild( "Humanoid" ) |
12 | local userInput = game:GetService( "UserInputService" ) |
14 | local mouse = game.Players.LocalPlayer:GetMouse() |
18 | local replicatedstorage = game:GetService( 'ReplicatedStorage' ) |
19 | local event = replicatedstorage:WaitForChild( 'PistolFire' ) |
21 | gun.Equipped:Connect( function (mouse) |
23 | local anim 2 = hum:LoadAnimation(script.Parent.Equip) |
24 | local current 2 = anim 2 |
29 | player.PlayerGui.AmmoGui.Ammo.Visible = true |
30 | player.PlayerGui.AmmoGui.Ammo.Text = "Ammo: " .. tostring (ammo.Value) .. " / " .. gun.MaxAmmo.Value |
32 | mouse.Button 1 Down:Connect( function () |
33 | if gun.Ammo.Value > 0 then |
34 | event:FireServer(gun.Handle.Position, gun.Handle.Orientation, mouse.Hit.p) |
36 | local anim = hum:LoadAnimation(script.Parent.Animation) |
39 | gun.Ammo.Value = gun.Ammo.Value - 1 |
45 | mouse.Button 2 Down:Connect( function () |
47 | local camera = game.Workspace.CurrentCamera |
49 | camera.FieldOfView = 40 |
53 | mouse.Button 2 Up:Connect( function () |
55 | local camera = game.Workspace.CurrentCamera |
57 | camera.FieldOfView = 70 |
63 | gun.Unequipped:Connect( function () |
64 | player.PlayerGui.AmmoGui.Ammo.Visible = false |
67 | userInput.InputBegan:Connect( function (input, gameProcessed) |
69 | if not gameProcessed then |
70 | if input.UserInputType = = Enum.UserInputType.Keyboard then |
71 | local keycode = input.KeyCode |
72 | if keycode = = Enum.KeyCode.R then |
73 | if gun.Ammo.Value < clipsize and gun.MaxAmmo.Value > 0 then |
75 | local anim 3 = hum:LoadAnimation(script.Parent.Reload) |
76 | local current 3 = anim 3 |
78 | reloadsound.Ended:Wait() |
79 | if gun.MaxAmmo.Value - (clipsize - gun.Ammo.Value) > = 0 then |
80 | gun.MaxAmmo.Value = gun.MaxAmmo.Value - (clipsize - gun.Ammo.Value) |
81 | gun.Ammo.Value = clipsize |
83 | gun.Ammo.Value = gun.Ammo.Value + gun.MaxAmmo.Value |
85 | player.PlayerGui.AmmoGui.Ammo.Text = "Ammo: " .. tostring (ammo.Value) .. " / " .. gun.MaxAmmo.Value |
94 | ammo.Changed:Connect( function () |
95 | player.PlayerGui.AmmoGui.Ammo.Text = "Ammo: " .. tostring (ammo.Value) .. " / " .. gun.MaxAmmo.Value |