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

Can someone help me fix this?

Asked by
RAYAN1565 691 Moderation Voter
10 years ago

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.

01local Button = script.Parent
02Frame = script.Parent.Parent.Parent
03a = script.Parent.Parent.AudioIDInsert.Text    
04 
05function onClick()
06        game.Workspace.RadioModel.Music.Script.Sound.SoundId="http://www.roblox.com/asset/?id=" .. a
07        wait(0.1)      
08        Frame:Destroy()
09end
10 
11Button.MouseButton1Click:connect(onClick)
1
If you need some more information. Please request. I even have my place un copy locked so you can see whats going on. RAYAN1565 691 — 10y

1 answer

Log in to vote
2
Answered by 10 years ago
1local Button = script.Parent
2Frame = script.Parent.Parent.Parent  
3function onClick()
4    a = script.Parent.Parent.AudioIDInsert.Text 
5        game.Workspace.RadioModel.Music.Script.Sound.SoundId="http://www.roblox.com/asset/?id=" .. a
6        wait(0.1)     
7        Frame:Destroy()
8end
9Button.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.

Ad

Answer this question