GUI in-game sound library

So i want to make a sound library (of all my ingame sounds) for my admin panel, But all attempts have failed. It is not cloning the placeholder TextButton.
Current script:

for _,v in pairs(workspace:GetDescendants()) do
	if v:IsA("Sound") then
		local clone = script.Parent.PlaceHolder:Clone()
		local id = v.SoundId:match("%d+")
		local info = game:GetService("MarketplaceService"):GetProductInfo(id, Enum.InfoType.Asset)
		clone.Name = v.Name
		clone.Text = info.Name
		clone.MouseButton1Click:Connect(function()
			game.ReplicatedStorage.RemoteEvents.Music:FireServer(id)
		end)
		task.wait()
	end
end

Help is highly appreciated!

Don’t forget to set the parent of the clone.

e.g.

clone.Parent = script.Parent
1 Like

Did you forget to set the parent of the clone? I don’t see it anywhere in your script.

oml-
bruhhh
how did i forget…
adding rn

1 Like


Result after doing so.

Still no cloning of the textbuttons.

Maybe they are stacked on top of each other? Check the explorer pane.

I am using a UIGridLayout, So that is not the issue.

1 Like

Are there any errors in the Output pane? (View>Output) Try using the debugger to step through the script and see where it stops/doesn’t happen.

There are no errors at all, I have checked it.

Try removing match(%d+) from local id = v.SoundId:match("%d+").

Edit: I’m playing the guessing game now, I don’t know what the culprit is anymore. It may be outside of the script provided.

1 Like

The server script already has rbxassetid:// pre-set, So the :match(%d+) searches for the numbers only.

You are using game:GetService("MarketplaceService"):GetProductInfo() in the local script, (which i believe requires rbxassetid:// to work properly) so it isn’t actually getting product info.

Can’t you just add id:match(%d+") to game.ReplicatedStorage.RemoteEvents.Music:FireServer(id) instead?

1 Like

image
This is something i have to tell my game version, As u can see, It does not require rbxassetid://

Accidentally had the script disabled.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.