generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Need assistance on a small thing

Previous Thread :: Next Thread 
virginia is not online. 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
IcedVapour is not online. IcedVapour
Joined: 10 Nov 2013
Total Posts: 2741
10 Mar 2017 01:49 PM
put a sound in StarterGui put a localscript inside it.

then just do

script.Parent:Play()
Report Abuse
maxi123456 is not online. maxi123456
Joined: 10 Apr 2009
Total Posts: 148
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
Gomlsauresrex is not online. Gomlsauresrex
Joined: 25 Mar 2016
Total Posts: 3588
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
Gomlsauresrex is not online. Gomlsauresrex
Joined: 25 Mar 2016
Total Posts: 3588
10 Mar 2017 01:51 PM
or* not "of"

Typo
Report Abuse
IcedVapour is not online. IcedVapour
Joined: 10 Nov 2013
Total Posts: 2741
10 Mar 2017 01:52 PM
Or use SoundScape and put do

:PlayLocalSound(sound)

so you can do it without FE
Report Abuse
virginia is not online. 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 is not online. 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
IcedVapour is not online. IcedVapour
Joined: 10 Nov 2013
Total Posts: 2741
10 Mar 2017 01:58 PM
yes
Report Abuse
maxi123456 is not online. maxi123456
Joined: 10 Apr 2009
Total Posts: 148
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
IcedVapour is not online. IcedVapour
Joined: 10 Nov 2013
Total Posts: 2741
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
maxi123456 is not online. maxi123456
Joined: 10 Apr 2009
Total Posts: 148
10 Mar 2017 02:00 PM
^ Nvm forgot that PlayerGuis dont replicated either, I take everything back!
His method will work
Report Abuse
virginia is not online. 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 is not online. 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 is not online. 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
maxi123456 is not online. maxi123456
Joined: 10 Apr 2009
Total Posts: 148
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
maxi123456 is not online. maxi123456
Joined: 10 Apr 2009
Total Posts: 148
10 Mar 2017 02:37 PM
^(Just edit the example below on that wiki page)
Report Abuse
Oryxide is not online. 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 is not online. 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 is not online. 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
OnceAlwaysFamous is not online. OnceAlwaysFamous
Joined: 07 Sep 2015
Total Posts: 135
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
OnceAlwaysFamous is not online. OnceAlwaysFamous
Joined: 07 Sep 2015
Total Posts: 135
10 Mar 2017 02:41 PM
Not sure why ## ############# was hashtagged, but okay.
Report Abuse
virginia is not online. 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
OnceAlwaysFamous is not online. OnceAlwaysFamous
Joined: 07 Sep 2015
Total Posts: 135
10 Mar 2017 04:44 PM
@virginia Where did you define Audio?
Report Abuse
virginia is not online. virginia
Joined: 07 Jun 2007
Total Posts: 199
10 Mar 2017 04:52 PM
@once It is in startergui

StarterGui > Sound > LocalScript


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image