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

Is my audio not playing or is it the local script that's not making the sound play?

Okay, so, I got bored and decided to try making some simple music player but whenever I try to play music with it, it just doesn't work? It's a local script and here's the code for it to play.

script.Parent.MouseButton1Click:Connect(function()
	local input = script.Parent.Parent.CustomSongID.Text
	local sound = script.Parent.Parent.Parent.Music
	   
	    sound.SoundId = 'rbxasset://'..input
	     sound:Play()
	      
    
end)

So, it's like this. When you click the "Play" button it'll get the text from the TextBox (CustomSongID) then it'll change the sound id of the sound in the ScreenGui then play it but for some reason, it just doesn't play it. I'm not sure if it has something to do with my audio, I did in fact check that I had roblox volume on and adjusted system volume, the ScreenGui has a whitelist by the way. I just wanted this music player to appear for certain people, so maybe that's why?

local player = game.Players.LocalPlayer
local Whitelist = {
	"Disgreace",
	"Username",
	"Username",
	"Username",
}

local function IsWhitelisted()
	local IsWhite = false
	
	for I,v in pairs(Whitelist) do
		if player.Name == v then
			IsWhite = true
			break
		end
	end
 
    return IsWhite 
end

if IsWhitelisted()then 
	script.Parent.Frame.Visible = true -- This is the frame for buttons
	script.Parent.Soundboard.Visible = true -- This is the frame for the soundboard and stuff
	script.Parent.Close.Visible = true -- This is the close button for the music player
else
	script.Parent.Frame.Visible = false
	script.Parent.Soundboard.Visible = false
	script.Parent.Close.Visible = false
end

Yeah, pretty much. Roblox Studio sounds work, the OOF sound works, walking works, previewing sounds in Roblox Studio works but it just won't like play the sound, like I can't hear it, not really sure how I could fix this. If it's just my audio or something, then please just tell me. Also, the whitelist is like, it checks if your name is in the table then if yes, the music player will appear for you. I'm not really sure if this is my audio thingy or whatever but it's Realtek High Definition Audio.

2 comments

0

"IsWhite" smh racist

0

xd

1 answer

✓ Accepted answer

Judging by your structural hierarchy. I’m going to assume your sound isn’t in workspace. It must be played there. Please fix up your script to match listed at the end following every variable. It sends the wrong message.

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