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

Can someone help me fix this?

This is in a GUI. I want this script to take what the player types in the text box and put it at the end of the link "http://www.roblox.com/asset/?id=" and finally paste the link in the SoundId property of the Sound object. I tried the script below. But it doesn't seem to work.

local Button = script.Parent
Frame = script.Parent.Parent.Parent
a = script.Parent.Parent.AudioIDInsert.Text		

function onClick() 
		game.Workspace.RadioModel.Music.Script.Sound.SoundId="http://www.roblox.com/asset/?id=" .. a
		wait(0.1)		
		Frame:Destroy()
end
		
Button.MouseButton1Click:connect(onClick)

1 comment

1

If you need some more information. Please request. I even have my place un copy locked so you can see whats going on.

1 answer

✓ Accepted answer
local Button = script.Parent
Frame = script.Parent.Parent.Parent   
function onClick()
	a = script.Parent.Parent.AudioIDInsert.Text  
        game.Workspace.RadioModel.Music.Script.Sound.SoundId="http://www.roblox.com/asset/?id=" .. a
        wait(0.1)      
        Frame:Destroy()
end
Button.MouseButton1Click:connect(onClick)

Its simple, because when the script runs the a value was outside the function so when the script runs it automatically saves what the value is and doesnt update when you use the function, if it is inside then it updates.

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