I'm new to scripting. I have a functioning GUI with all the sounds working perfectly when the buttons are clicked, but only the player can hear the sounds, not other players near them. I'm beginning to understand maybe it's because I'm using LocalScript? I tried using switching to just Script but then the sound doesn't play at all. Do the sounds need to be in the Workspace and the script inside of the starter GUI needs to reference where the sound is? I don't really undstand how to do that either. Hear is the script im using now:
script.Parent.MouseButton1Click:Connect(function() script.Parent.Love.Playing = true end)
And this is the setup: Starter GUI>GUI>Frame>TextButton>LocalScript & Sound
Move the sound to a folder in Workspace. Have the localscript in the StarterGui. Have a script in Workspace or ServerScriptService. Have a RemoteEvent in ReplicatedStorage
Have this in the local script
event = game.ReplicatedStorage["Remote Event Name"] --Put it inside the button btw script.Parent.MouseButton1Click:Connect(function(Fire) event:FireServer("Play", game.Players.LocalPlayer.Character.Head.SoundNameHere) -- Here wait() end)
Ok now put this inside the script
event = game.ReplicatedStorage["Remote Event Name"] event.OnServerEvent:Connect(function(state, sound) if state == "Play" then wait() sound:Play() end end)
Tell me if this worked for you or if it didn't.
Edit: I've edited the local script above. Just change the SoundNameHere and put the sound inside the head with this handy script (Put it in Workspace and put the sound in Workspace)
game.Players.PlayerAdded:Connect(Function(plr) local sound = game.Workspace["Your Sound Name Here"] wait(2) -- lower or increase this if you get an error sound.Parent = game.Workspace[plr.Name].Head end)