Jetskiis
|
  |
| Joined: 17 Aug 2017 |
| Total Posts: 356 |
|
|
| 25 Nov 2017 04:18 PM |
I have a radio script that plays music by inputting the song id if the player wishes to do so but whenever the player dies the music automatically stops and the player has to manually turn it on again by inputting the song id.
How do I make it so that the music continues playing once the player respawns
(ignore censored parts)
local sound = Instance.new("Sound") sound.Volume=1 sound.Pitch=1 sound.Name="" sound.Looped=true sound.PlayOnRemove=false local player = game.Players.LocalPlayer.Character sound.Parent = player.Radio local Format = (CENSORED) local frame = script.Parent:WaitForChild("Frame")
frame:WaitForChild("Play").MouseButton1Click:connect(function() local input = tonumber(frame:WaitForChild("Input").Text) if input then sound:Stop() CENSORED sound:Play() end end) frame:WaitForChild("Stop").MouseButton1Click:connect(function() sound:Stop() end)
|
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 25 Nov 2017 04:21 PM |
That's because your GUI doesn't stay with them past death. You can change that, but you may not want that functionality. To do so, go to the StarterGui and make sure that ResetPlayerGuiOnSpawn is set to false. |
|
|
| Report Abuse |
|
|
Jetskiis
|
  |
| Joined: 17 Aug 2017 |
| Total Posts: 356 |
|
|
| 25 Nov 2017 04:24 PM |
I don't see anything called that under properties for playergui
only see something called showdevelopmentgui
|
|
|
| Report Abuse |
|
|
Jetskiis
|
  |
| Joined: 17 Aug 2017 |
| Total Posts: 356 |
|
| |
|
|
| 25 Nov 2017 04:26 PM |
| You have to do it on the actuall screengui itself not on StarterGui. |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 25 Nov 2017 04:26 PM |
http://wiki.roblox.com/index.php?title=API:Class/StarterGui/ResetPlayerGuiOnSpawn
Apparently it's deprecated. You can do this with individual ScreenGuis, though, which is a much nicer solution: http://wiki.roblox.com/index.php?title=API:Class/ScreenGui/ResetOnSpawn |
|
|
| Report Abuse |
|
|
|
| 25 Nov 2017 04:27 PM |
looks like ResetPlayerGuiOnSpawn has been deprecated http://wiki.roblox.com/index.php?title=API:Class/StarterGui/ResetPlayerGuiOnSpawn
u now have to set the ResetOnSpawn value for each individual ScreenGui
|
|
|
| Report Abuse |
|
|
|
| 25 Nov 2017 04:28 PM |
ignore pls i was not fast enough ;(
|
|
|
| Report Abuse |
|
|
Jetskiis
|
  |
| Joined: 17 Aug 2017 |
| Total Posts: 356 |
|
|
| 25 Nov 2017 04:31 PM |
I changed the setting but nothing seems to have changed
the gui is working perfectly but it just needs to log the music that was previously being played and continue where it left off once the player respawned but how does one do that
|
|
|
| Report Abuse |
|
|
|
| 25 Nov 2017 04:33 PM |
"local player = game.Players.LocalPlayer.Character sound.Parent = player.Radio"
when the player dies, their character gets destroyed and they get a new character the sound gets destroyed along with the character
|
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 25 Nov 2017 04:34 PM |
*facepalm* lmao bro come on |
|
|
| Report Abuse |
|
|
Jetskiis
|
  |
| Joined: 17 Aug 2017 |
| Total Posts: 356 |
|
|
| 25 Nov 2017 04:36 PM |
how do i work around this?
and yeah im really bad at scripting so i had a feeling there was a small error in my script
|
|
|
| Report Abuse |
|
|
|
| 25 Nov 2017 04:38 PM |
one solution i can think of is putting the radio outside of the character and welding it to the character
when the player dies, wait for them to get a new character and then reweld the radio again to the new character.
the radio should not be destroyed when the player dies because it is not a child of the character.
|
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 25 Nov 2017 04:38 PM |
Nooo it's just a logic thing Like, the character gets removed when they die, so parenting the sound to it clearly ain't gonna work out :P
You work around it by putting the sound in the PlayerGui or something. |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 25 Nov 2017 04:41 PM |
Unless you need it to emanate from the character, in which case you can either memorize the TimePosition of your sound just before the time of Respawn and play a new Sound at that TimePosition from the radio, or just never remove the radio in the first place by keeping it outside the char. http://wiki.roblox.com/index.php?title=API:Class/Sound/TimePosition |
|
|
| Report Abuse |
|
|
Jetskiis
|
  |
| Joined: 17 Aug 2017 |
| Total Posts: 356 |
|
|
| 25 Nov 2017 04:44 PM |
ayyy i fixed it by linking the sound to playergui instead
soybeen/god
link a shirt for 50 each ill tell my friend to buy
|
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 25 Nov 2017 04:46 PM |
| 🤑 I help people on this forum for free 🤑 |
|
|
| Report Abuse |
|
|
Jetskiis
|
  |
| Joined: 17 Aug 2017 |
| Total Posts: 356 |
|
|
| 25 Nov 2017 04:47 PM |
What a legendary man in RBXDev O_O
|
|
|
| Report Abuse |
|
|