Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

SoundId needs a string and not an object?

local relaxid = "231311947"
function playmusic(id, replay)
	playing = true
	if game.Workspace:FindFirstChild("music") then
		game.Workspace:FindFirstChild("music"):Stop()
		game.Workspace:FindFirstChild("music"):Destroy()
	end
	local music = Instance.new("Sound", game.Workspace)
	music.Name = "music"
	music.SoundId = id
	if replay == true then
		music.Looped = true
	else
		music.Looped = false
	end
	music:Play()
end

playmusic(relaxid, true)

The problem with this script is that it says that music.SoundId needs to be a string, and that id is an object. How would i turn id into a string?

2 answers

✓ Accepted answer

Heres the problem I see. To use an sound Id, you will need the prefix rbxassetid:// before the song ID. So, your relaxid variable should be this.

local relaxid = 'rbxassetid://231311947'

You need to change it to "rbxassetid://" then your Id number :)

This discussion is preserved as it was. New answers, comments, and votes are closed.