#SoundID Transmit through a StringValue isn't working
1 messages · Page 1 of 1 (latest)
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)
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)