Wait how would i test it if i don’t have the song ID of another person’s song? (Besides roblox’s trashy songs)
a numbervalue named “BGM” it holds the song ID of the song.
if it has the id of the song then use that id.
Ok, I have another question. Would the song play even if it’s longer than 6 seconds or privated? And, would I use :GetAsset() to get the song?
well I can’t remember at the state of my brain right now but you can text that out. Also just use play (rblx/asset:id) also if it doesnt work use getasset but I dont think you need to get asset if you already have it.
Like I think I would use :GetAsset() to see if the song exists. So it doesent error.
Simplest way I know of is just this. There’s probably a service to simplify it but this is how I’d do it.
Unless I’m misunderstanding and this is about some kind of new Music feature I never heard about.
local Link = "rbxassetid://1234567890"
local NewAudio = Instance.new('Sound')
NewAudio.SoundId = Link
NewAudio:Play()
This is completely off topic but, how do you indicate that the thing you’re writing is a script since when i do it some parts are text and some are script.
Use ``` (triple-backticks)
Like this:
print("Hello!")
And the raw text is:
```
print(“Hello!”)
```
ok thanks for telling me, thats been a really big struggle for me, I can show my scripts now! Lemme whip up a quick example script.
Would this be good? (I don’t know how to get the function, “:GetAsset”)
local map = game.Workspace.Maps.StuddedMountain
-- Pretend the song is a custom song and not by roblox!
local song = map.Settings.BGM -- 1234567890
local soundObject = Instance.new("Sound", game.Workspace)
soundObject.SoundId = "rbxassetid://"..song.Value -- rbxassetid://1234567890
soundObject:Play()
Yes. That should work.
chaaaars
That would work. Unless BGM is a intvalue / numbervalue / whatever, still gotta add the .Value
at the end if that’s the case. I’ll just assume you know what you’re doing though.
I’d say im a decent scripter but with this topic of scripting, I’m a total idiot…
Yes. You do need to add .Value if it is a ValueBase object. (IntValue, NumberValue, …)
Back to what I said about “What if players put in songs that they’ve made?” Would the script I made support that? (I’m guessing no with the new audio update…)
Yep. But if there’s any issues, keep us posted.
Ok, thank you to everyone that attempted to help! I’m not sure who to set as “The Solution” anyways hehe. Would be greedy if I gave myself the solution though… I’ll just keep this post open for more issues. Maybe like a new post and give this post a link maybe?