Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Textbox text error with radio script?

Asked by 6 years ago

This is the error for my radio

****18:10:57.458 - Sound Workspace.Odawg566.UpperTorso.Sound Failed to load ****rbxassetid://Enter ID Here

The textbox's starting text is Enter ID Here, but when I add a music Id it wont change to the new id, instead it picks up the textbox's old text "Enter ID Here".

It's been bothering me for a while, some help would be nice.

local PlayButton = script.Parent:WaitForChild("Play")
local StopButton = script.Parent:WaitForChild("Stop")
local ID = script.Parent:WaitForChild("Id")
local event = script.Parent:WaitForChild("PlayMusic")
local event1 = script.Parent:WaitForChild("StopMusic")

wait(1) 
event.OnServerEvent:connect(function(plr)
   if plr.Character.UpperTorso:FindFirstChild("Sound") then
        print("Has Sound")
    else
        local effect = script:WaitForChild("Beats"):Clone()
        effect.Parent = plr.Character.UpperTorso
     local sound = Instance.new("Sound", plr.Character.UpperTorso)
     print("Giving Sound")
     sound.SoundId = "rbxassetid://"..ID.Text 
    sound.Looped = true
    sound.Archivable = true
    sound.MaxDistance = 50
    sound.EmitterSize = 10
    sound.Volume = 3
    sound.Playing = true
end
end)

event1.OnServerEvent:connect(function(plr)

    if plr.Character.UpperTorso:FindFirstChild("Sound") then
        plr.Character.UpperTorso.Beats:Destroy()
        plr.Character.UpperTorso.Sound:Destroy()
    else
        print("No Sound Found")
    end
end)

1 answer

Log in to vote
-1
Answered by 6 years ago

You should try messing around with the textbox, because there could be a lot of reason, you can add wait()

0
I tried to add a wait but even with a wait it wont load the new text. Odawg566 9 — 6y
0
Maybe you should try adding another StringValue and set that value to the text in the TextBox, and then add that value to the SoundId, That's how you do it indirectly and I believe it should work, this happened to me once Konethorix 197 — 6y
Ad

Answer this question