#SoundID Transmit through a StringValue isn't working

1 messages · Page 1 of 1 (latest)

gleaming saddle
#

is this the local script that i see to the right?

#

add debug prints, that will help

#

is this text box in the workpace? i dont think local scripts function in the workspace.. 😕 (im very confused)

gleaming saddle
#

maybe this sample can help

-- LOCAL script in the musicPart, NOT the workspace...

local textBoxPart = game.Workspace:WaitForChild("musicPart")

local textbox = textBoxPart:WaitForChild("SurfaceGui"):WaitForChild("TextBox")
local RS = game:GetService("ReplicatedStorage")

local musicPlayer = game:GetService("SoundService"):WaitForChild("MusicPlayer")

textbox.Focused:Connect(function() -- for example, not rlly needed
    print("FOCUSED!") -- debug print
    textBoxPart.BrickColor = BrickColor.new("Really red")
end)

textbox.FocusLost:Connect(function() -- when pressed enter, focus ends anyway
    textBoxPart.BrickColor = BrickColor.new("Medium stone grey")
    print("FOCUSED ENDED!") -- debug print
    -- above is for example
    
    local input = textbox.Text
    if input and input ~= "" then
        warn(input) -- debug print, this is whatt he player wrote before focus ended/enter pressed, if you want a button, set that up ig lol
        
        if tonumber(input) then -- checking if it's numbers only
            
            musicPlayer.SoundId = "rbxassetid://" .. input -- adds the link stuff :D
            task.wait()
            musicPlayer:Play()
            
        elseif not tonumber(input) then
            warn("The TextBox input must contain only numbers!") -- debug print
        end
        
    else
        warn("Something went wrong!") -- debug print
    end
    
end)
sonic marsh
#

local scripts dont function in workspace just answering that

#

if input exists

#

why are you checking if a .Text is there

#

its automatically there

#

remove that line

#

also i wouldnt do "local id = blah blah tostirng stuff"

#

id just so

#

do