I am making a roblox gun and I want to make the gun shot play from the handle / gun so all players can hear when the gun is shot but I am unsure of how to do it. Currently the gunshot sound is only heard for the player firing but how would I do it so its heard from the gun instead so all players can hear it? Here is my current script that only works for the Local Player.
ReloadSound = Instance.new("Sound", GunGUILocation) ReloadSound.SoundId = "rbxassetid://2773470737" ReloadSound.PlayOnRemove = true ReloadSound:Play() ReloadSound:Destroy()
Also GUNGuiLocation = to the player gui.
This is in a LocalScript, that's why its only playing for the client. Assuming there's more in this script that needs to in a LocalScript then you can use RemoteEvents. Basically it allows the client and server to communicate.
Have this code in a server script and have it activate when a RemoteEvent is triggered.
local function Reload() ReloadSound = Instance.new("Sound", GunGUILocation) ReloadSound.SoundId = "rbxassetid://2773470737" ReloadSound.PlayOnRemove = true ReloadSound:Play() ReloadSound:Destroy() end RemoteEvent.OnServerEvent:Connect(Reload)
Replace RemoteEvent
with your RemoteEvent
And trigger the RemoteEvent with a local script
RemoteEvent:FireServer()
Replace RemoteEvent
with your RemoteEvent