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

Why am I getting soundID is not valid member of ScreenGui?

This is the entire code

local gui = Instance.new("ScreenGui")
gui.Parent = script.Parent
gui.Name = "Boombox"
wait()
local frame = Instance.new("Frame")
frame.Parent = script.Parent.Boombox
frame.Position = UDim2.new(0.02, 0, 0.8, 0)
frame.Size = UDim2.new(0.25, 0, 0.05, 0)
frame.BackgroundTransparency = 0
frame.BackgroundColor3 = Color3.fromRGB(79,158,255)
wait()
local text = Instance.new("TextBox")
text.Parent = script.Parent.Boombox.Frame
text.BackgroundColor3 =  Color3.fromRGB(79,158,255)
text.Position = UDim2.new(0.1, 0, 0.3, 0)
text.Size = UDim2.new(0.6, 0, 0.48, 0)
text.BorderSizePixel = 0
text.TextStrokeTransparency = 0
text.TextColor3 = Color3.fromRGB(186,186,186)
text.Text = "Music ID here"
wait()
local desc = Instance.new("TextLabel")
desc.Parent = script.Parent.Boombox.Frame
desc.Name = "Boombox"
desc.Text = "Boombox Pass | Use ctrl + v to paste"
desc.Position = UDim2.new(0, 0, -0.58, 0)
desc.Size = UDim2.new(0.7, 0, 0.5, 0)
desc.BackgroundColor3 =  Color3.fromRGB(79,158,255)
desc.TextStrokeTransparency = 0
desc.TextColor3 = Color3.fromRGB(186,186,186)
wait()
local play = Instance.new("TextButton")
play.Parent = script.Parent.Boombox.Frame
play.Position = UDim2.new(0.743, 0, 0, 1)
play.Size = UDim2.new(0.12, 0, 0.9, 0)
play.BorderSizePixel = 0
play.Text = "Play"
play.BackgroundColor3 = BrickColor.Green().Color
play.Name = "Play"
wait()
local stop = Instance.new("TextButton")
stop.Parent = script.Parent.Boombox.Frame
stop.Position = UDim2.new(0.87, 0, 0, 1)
stop.Size = UDim2.new(0.12, 0, 0.9, 0)
stop.BorderSizePixel = 0
stop.Text = "Stop"
stop.BackgroundColor3 = BrickColor.Red().Color
stop.Name = "Stop"
wait()
local sound = Instance.new("Sound")
sound.Parent = script.Parent
sound.Name = "Music"
function play()
    script.Parent.Music.SoundId = "rbxassetid://"..script.Parent.Boombox.Frame.TextBox.Text
    script.Parent.Music:Play()
end
script.Parent.Boombox.Frame.Play.MouseButton1Click:connect(play)

function stop()
    script.Parent.Music:Stop()
end
script.Parent.Boombox.Frame.Stop.MouseButton1Click:connect(stop)

The focus is on the second line here,

function play()
    script.Parent.Music.SoundId = "rbxassetid://"..script.Parent.Boombox.Frame.TextBox.Text
    script.Parent.Music:Play()
end
script.Parent.Boombox.Frame.Play.MouseButton1Click:connect(play)

When I insert a music ID and click play, STUDIO tells me that SoundId is not a valid member of ScreenGui...why is this? This script used to work fine.

3 comments

0

Can you provide a screenshot of the model please?

0

Sure, http://i.imgur.com/ifiLeCf.png that is what the script makes

0

Worked perfectly fine for me when I tested it, is FE enabled?

1 answer

Well, on the image you sent which is: http://i.imgur.com/ifiLeCf.png It looks like i get it; Therefore, the studio tells you "SoundId is not a valid member of the ScreenGUI" The problem is that something is not placed Correctly.

Please make sure:

  • There are no multiple object named "Music"
  • Instances are correctly placed.

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