of     2   
chevron_rightchevron_rightchevron_right

biny7884
#216113500Sunday, May 07, 2017 1:02 PM GMT

I have no idea how to make sound local not global. Any help?
electricpretzel0
#216113572Sunday, May 07, 2017 1:03 PM GMT

Put the sound instance within the player of your choice. It can even be inside a descendant of the player.
biny7884
#216113677Sunday, May 07, 2017 1:04 PM GMT

So, how would I do this exactly. I am kind of a beginner here but I know quite a bit of code
biny7884
#216113754Sunday, May 07, 2017 1:06 PM GMT

Would I put the sounds in replicatedstorage and then clone them into someone when they join?
ImVortexe
#216116621Sunday, May 07, 2017 2:01 PM GMT

game.Players.PlayerAdded:connect(function(player) Instance.new("Sound", player.PlayerGui)
Gomlsauresrex
#216116925Sunday, May 07, 2017 2:07 PM GMT

Theres a function is SoundService that plays a sound only for the client. --Put this code in a script that should be the parent of the sound. game:GetService("SoundService"):PlayLocalSound(script.Parent)
Gomlsauresrex
#216116948Sunday, May 07, 2017 2:07 PM GMT

There's a function in SoundService*
biny7884
#216118876Sunday, May 07, 2017 2:41 PM GMT

Thanks for the reply but I am actually dying this is impossible... I am making a gamepass button and trying to play differ music when pressed but the problem is that it plays the mmusic for the whole client. I see that this was helpful if there was a different type of scenario but this one is just, GRRRRR.. Script inside of a button inside of a screengui in startergui -------------------------------------- local Button = script.Parent local Guisound = workspace.MusicFolder.Guimusic.Script local Normalsound = workspace.MusicFolder.Adventure.Script Box = script.Parent.Parent.Box Frame = script.Parent.Parent.Frame PCWARS = script.Parent.Parent.Frame.PCWARS GAMES = script.Parent.Parent.Frame.GAMES DEVELOP = script.Parent.Parent.Frame.ImageLabel ----------------------Code---------------------------- function onClick() if Box.Visible == false then DEVELOP.Visible = true GAMES.Visible = true PCWARS.Visible = true Box.Visible = true Frame.Transparency = 0 Normalsound.Parent.Playing = false Guisound.Parent.Playing = true Button.Text = "Gamepasses{ALPHA SALE}" elseif Box.Visible == true then DEVELOP.Visible = false GAMES.Visible = false PCWARS.Visible = false Box.Visible = false Frame.Transparency = 1 Guisound.Parent.Playing = true Normalsound.Parent.Playing = false Button.Text = "Gamepasses{ALPHA SALE}" end end Button.MouseButton1Click:connect(onClick) -----------------------El' fine------------------------- Any help will be much appreciated on this occasion..
nullfeels
#216121487Sunday, May 07, 2017 3:23 PM GMT

Okay so... If you want to play a sound globally don't do anything special to it, just put it in the workspace or a folder in the workspace, etc. If you want to play a 3D positional sound you put the sound file INSIDE of a part or union, and it will play the sound from that location. If you want to play a sound only for one player then use the PlayLocalSound function of the SoundService. game.SoundService:PlayLocalSound(sound)
nullfeels
#216122013Sunday, May 07, 2017 3:32 PM GMT

Also, just an additional tip, but code like: if something.Visible == true then is unnecessary and redundant. Instead use just: if something.Visible then It is the same thing, but cleaner, more professional even... and if you want to check if, for example, something is not visible... if not something.Visible then is the preferred way of doing that. Nothing wrong with your code, but just wanted to mention that.
nullfeels
#216122710Sunday, May 07, 2017 3:44 PM GMT

One more tip... In your on click event handler function you check if the box is not visible and if it is visible. This is also very redundant. Instead just check if the box is visible or else. i.e.: if box.Visible then do something else do something else end That is all :P And again I'm not trying to nitpick, but small changed like this will make your code much cleaner and easier to maintain in the end.
LarsSaysWhaa
#216125963Sunday, May 07, 2017 4:24 PM GMT

Insert the sound in the object you want, for example if its a wall make the Sound Parent The wall Then in the properties of the sound you can edit the range from where you can hear it. Hope this helps
biny7884
#216126158Sunday, May 07, 2017 4:27 PM GMT

Ok this is actually getting on my nerves now can someone write me the code plz because this is my code and it seems fine(I haven't changed to what the other guy said :P) game:GetService("SoundService") local Button = script.Parent local Adventure = script.Parent.parent.MusicFolder.Adventure local Guimusic = script.Parent.Parent.MusicFolder.Guimusic local Box = script.Parent.Parent.Box Frame = script.Parent.Parent.Frame PCWARS = script.Parent.Parent.Frame.PCWARS GAMES = script.Parent.Parent.Frame.GAMES DEVELOP = script.Parent.Parent.Frame.ImageLabel function onClick() if Box.Visible == false then DEVELOP.Visible = true GAMES.Visible = true PCWARS.Visible = true Box.Visible = true Guimusic.Volume = 0.5 Guimusic:PlayLocalSound() Adventure.Volume = 0 # #Fr################## 0 Button.Text = "Gamepasses{ALPHA SALE}" elseif Box.Visible == true then DEVELOP.Visible = false GAMES.Visible = false PCWARS.Visible = false Box.Visible = false Adventure.Volume = 0.5 Adventure:PlayLocalSound() Guimusic.Volume = 0 ################## = 1 Button.Text = "Gamepasses{ALPHA SALE}" end end Button.MouseButton1Click:connect(onClick)
nullfeels
#216127864Sunday, May 07, 2017 4:45 PM GMT

Your code has a lot of issues to be honest, but here... I cannot guarantee this to work, it's just your code rewritten with errors corrected. local soundService = game.SoundService local button = script.Parent local adventure = script.Parent.Parent.MusicFolder.Adventure local guiMusic = script.Parent.Parent.MusicFolder.GuiMusic local box = script.Parent.Parent.Box local frame = script.Parent.Parent.Frame local pcwars = script.Parent.Parent.Frame.PCWARS local games = script.Parent.Parent.Frame.GAMES local develop = script.Parent.Parent.Frame.ImageLabel button.MouseButton1Click:connect(function() if (not box.Visible) then develop.Visible = true games.Visible = true pcwars.Visible = true box.Visible = true soundService:PlayLocalSound(guiMusic) adventure.Volume = 0 else develop.Visible = false games.Visible = false pcwars.Visible = false box.Visible = false adventure.Volume = 0.5 soundService:PlayLocalSound(adventure) guiMusic.Volume = 0 --whatever the censored thing is = 1 button.Text = "Gamepasses{ALPHA SALE}" end end)
biny7884
#216128479Sunday, May 07, 2017 4:52 PM GMT

The only error I see related to the code is... 17:50:05.214 - SoundService is not a valid member of DataModel 17:50:05.215 - Stack Begin 17:50:05.216 - Script 'Players.Player1.PlayerGui.ScreenGui.OpenClose.Script', Line 1 17:50:05.216 - Stack End
biny7884
#216128650Sunday, May 07, 2017 4:53 PM GMT

And how do you know all this stuff? i would love to know
nullfeels
#216129349Sunday, May 07, 2017 5:01 PM GMT

Hmm that's strange. Try replacing local soundService = game.SoundService with local soundService = game:GetService("SoundService") And I've just been a programmer for many years. It just come with time and practice. Just keep working at it, you'll get there.
biny7884
#216130542Sunday, May 07, 2017 5:13 PM GMT

Null, you have fixed it the only problem is how do I turn off the music when I have started playing it with a piece of code....
biny7884
#216130753Sunday, May 07, 2017 5:15 PM GMT

By "A piece of code" I mean when I have wrote soundService:PlayLocalSound(guiMusic)
nullfeels
#216131115Sunday, May 07, 2017 5:19 PM GMT

The Sound class has a Stop function. i.e. adventure:Stop() Should work.
nullfeels
#216131264Sunday, May 07, 2017 5:21 PM GMT

Also, this is your new best friend. ##########################################################
nullfeels
#216131351Sunday, May 07, 2017 5:22 PM GMT

Nope! Wasn't him :P google roblox api should be the first link.
biny7884
#216131661Sunday, May 07, 2017 5:25 PM GMT

Null, got discord if so just send there. +If I had 300 robux it would go to you for your help xD. Sadly I don't have 300 robux :P
nullfeels
#216131757Sunday, May 07, 2017 5:26 PM GMT

Nah, I don't have discord ATM. And don't worry about it, glad to help. :)
biny7884
#216132064Sunday, May 07, 2017 5:30 PM GMT

xD The stop isn't working xD

    of     2   
chevron_rightchevron_rightchevron_right