virginia
|
  |
| Joined: 07 Jun 2007 |
| Total Posts: 199 |
|
|
| 10 Mar 2017 01:46 PM |
So I am wondering how I would have a script that would play an audio locally to a player when the join the game.
It would just play the song through once and then be done.
Anyone want to help <3 Thank you!!
|
|
|
| Report Abuse |
|
|
|
| 10 Mar 2017 01:49 PM |
put a sound in StarterGui put a localscript inside it.
then just do
script.Parent:Play() |
|
|
| Report Abuse |
|
|
|
| 10 Mar 2017 01:50 PM |
When your game is FilteringEnabled and you already have set up an audio you want to play in workspace, just do:
workspace.YOURAUDIO:Play()
otherwise check this out: http://wiki.roblox.com/index.php?title=Sounds |
|
|
| Report Abuse |
|
|
|
| 10 Mar 2017 01:51 PM |
of
Enable FE and just use a client sided script and put the client sided script in the sound and add this to it.
script.Parent:Play() |
|
|
| Report Abuse |
|
|
| |
|
|
| 10 Mar 2017 01:52 PM |
Or use SoundScape and put do
:PlayLocalSound(sound)
so you can do it without FE
|
|
|
| Report Abuse |
|
|
virginia
|
  |
| Joined: 07 Jun 2007 |
| Total Posts: 199 |
|
|
| 10 Mar 2017 01:55 PM |
For my place I need FE off, but Iced method worked, thank you to the others that put their suggestions in!
|
|
|
| Report Abuse |
|
|
virginia
|
  |
| Joined: 07 Jun 2007 |
| Total Posts: 199 |
|
|
| 10 Mar 2017 01:56 PM |
@iced does your first method work with out FE?
|
|
|
| Report Abuse |
|
|
| |
|
|
| 10 Mar 2017 01:59 PM |
^ His method won't work with FE disabled, because it will replicate to the other clients.
(also "I need FE disabled for my game" is a bad excuse, everything is possible to work with FE) |
|
|
| Report Abuse |
|
|
|
| 10 Mar 2017 02:00 PM |
my second method will work without FE
do
local s = game:GetService("SoundService")
s:PlayLocalSound(script.Parent) |
|
|
| Report Abuse |
|
|
|
| 10 Mar 2017 02:00 PM |
^ Nvm forgot that PlayerGuis dont replicated either, I take everything back! His method will work |
|
|
| Report Abuse |
|
|
virginia
|
  |
| Joined: 07 Jun 2007 |
| Total Posts: 199 |
|
|
| 10 Mar 2017 02:23 PM |
So Iced first method worked but now every time you spawn in it plays, I want it so it only plays when you join the game and never again
|
|
|
| Report Abuse |
|
|
Oryxide
|
  |
| Joined: 09 Jul 2015 |
| Total Posts: 647 |
|
|
| 10 Mar 2017 02:31 PM |
Use :PlayerAdded
Use that as the trigger for the function with the sound in.
So when a player joins, it'll play. But if they die then it won't. |
|
|
| Report Abuse |
|
|
virginia
|
  |
| Joined: 07 Jun 2007 |
| Total Posts: 199 |
|
|
| 10 Mar 2017 02:34 PM |
@Ory
I am really really stupid when it comes to scripting so how exactly would I add that?
|
|
|
| Report Abuse |
|
|
|
| 10 Mar 2017 02:36 PM |
^ copy the finished script and edit it to your sound:Play() command. http://wiki.roblox.com/index.php?title=API:Class/Players/PlayerAdded
But someone will probably spoon feed you |
|
|
| Report Abuse |
|
|
|
| 10 Mar 2017 02:37 PM |
| ^(Just edit the example below on that wiki page) |
|
|
| Report Abuse |
|
|
Oryxide
|
  |
| Joined: 09 Jul 2015 |
| Total Posts: 647 |
|
|
| 10 Mar 2017 02:38 PM |
I only jsut started scripting really, that was just a fast summary of what it'll do for you.
I suggest learning to code, people probably won't give you the answer fully. |
|
|
| Report Abuse |
|
|
Oryxide
|
  |
| Joined: 09 Jul 2015 |
| Total Posts: 647 |
|
|
| 10 Mar 2017 02:40 PM |
Players.PlayerAdded:connect(aplayerhasentered) That'll call the function if it's called aplayerhasentered
Or do
Players.PlayerAdded:connect(function()) audio.Sound.Play() end) |
|
|
| Report Abuse |
|
|
Oryxide
|
  |
| Joined: 09 Jul 2015 |
| Total Posts: 647 |
|
|
| 10 Mar 2017 02:40 PM |
| I got my forums muddled up. PlayerAdded is quite simple. |
|
|
| Report Abuse |
|
|
|
| 10 Mar 2017 02:41 PM |
| If you're planning on using # ############ (which you have to use in one case or another for this), you're going to have to use RemoteEvents. If you use a LocalScript, it will be local (of course), so everytime someone joins, it will play the sound for LocalPlayer. Either way, for a sound to be local, you'll need to place the sound in their PlayerGui by firing your RemoteEvent and just use Humanoid/Died to check if the LocalPlayer has died and if so, remove the sound. (You can do this small part in a LocalScript w/out an issue.) |
|
|
| Report Abuse |
|
|
|
| 10 Mar 2017 02:41 PM |
| Not sure why ## ############# was hashtagged, but okay. |
|
|
| Report Abuse |
|
|
virginia
|
  |
| Joined: 07 Jun 2007 |
| Total Posts: 199 |
|
|
| 10 Mar 2017 04:40 PM |
Players.PlayerAdded:connect(function()) audio.Sound.Play() end)
This didnt start playing the song, any fixes?
|
|
|
| Report Abuse |
|
|
|
| 10 Mar 2017 04:44 PM |
| @virginia Where did you define Audio? |
|
|
| Report Abuse |
|
|
virginia
|
  |
| Joined: 07 Jun 2007 |
| Total Posts: 199 |
|
|
| 10 Mar 2017 04:52 PM |
@once It is in startergui
StarterGui > Sound > LocalScript
|
|
|
| Report Abuse |
|
|