Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Trying to create sound with Remote event ? Not working?

So i have RemoteEvent called sound in my Replicated Storage with the actual Sound called FireSound I have a script in serverscript called Sound Global that goes like this:

game.ReplicatedStorage.Sound.OnServerEvent:Connect(function(Player) local fireSound = game.ReplicatedStorage.FireSound fireSound:Play() end)

Inside my gun the code goes like this:

script.Parent.Activated:Connect(function() if Ammo>0 and not Reloading then Ammo=Ammo-1 game.ReplicatedStorage.Sound:FireServer() end

2 comments

0

fireSound is not a Sound instance, it points to a service. You can only play sounds if they're actually sounds.

0

It still does not work i just putted the sound

1 answer

you need to put the sound in either the gun tool or workspace, but i recommend the gun tool: then do the following

game.ReplicatedStorage.Sound.OnServerEvent:Connect(function(Player,name) 
local char = player.Character
local tool = char:FindFirstChild(name)
local fireSound = tool["name of the sound object"]

fireSound:Play()  
end)

Inside my gun the code goes like this:

script.Parent.Activated:Connect(function()  
if Ammo>0 and not Reloading then 
local tool_name = --put here the name of the tool
Ammo=Ammo-1  
game.ReplicatedStorage.Sound:FireServer(tool_name)  
end

This discussion is preserved as it was. New answers, comments, and votes are closed.