|
| 23 Apr 2014 09:24 PM |
| I'm trying to set some GUI up so that when I edit a text box, and then click a button, whatever was in the text box is set as an IntValue. Im having trouble with the onClicked function, and setting the IntValue. |
|
|
| Report Abuse |
|
|
| |
|
|
| 23 Apr 2014 09:25 PM |
| What code do you have so far? |
|
|
| Report Abuse |
|
|
|
| 23 Apr 2014 09:30 PM |
| I'm trying to post it, but it's being blocked for some reason. I'll try to PM it. |
|
|
| Report Abuse |
|
|
|
| 23 Apr 2014 09:31 PM |
| Im pretty sure some of it doesn't need to be there. I'm new at scripting. |
|
|
| Report Abuse |
|
|
|
| 23 Apr 2014 09:32 PM |
Easy.. Put this in a ServerScript inside the GUI: script.Parent.Changed:connect(function() local val==script.Parent.Text local int=DefineThisAsYourIntValue int.Value=val end) |
|
|
| Report Abuse |
|
|
|
| 23 Apr 2014 09:33 PM |
| You might have guessed I was making a TV, by the script. |
|
|
| Report Abuse |
|
|
|
| 23 Apr 2014 09:39 PM |
@imacheeseburger I tried that, it doesn't seem to work, even though it looks like it should. Now I'm just stumped. |
|
|
| Report Abuse |
|
|
| |
|
|
| 23 Apr 2014 10:02 PM |
| I guess this thread died. Last bump of hope. |
|
|
| Report Abuse |
|
|
|
| 23 Apr 2014 10:04 PM |
Where is the IntValue? Where is the TextBox? Where is the Button?
Also, have you ever heard of FilteringEnabled? If not, you won't have to worry about it.
You'll HAVE to use a LocalScript to handle the GUI events. |
|
|
| Report Abuse |
|
|
|
| 23 Apr 2014 10:13 PM |
val = script.Parent.Text int = Game.Workspace.Model.Screen.Channel Button = script.Parent
Button.MouseButton1Click:connect(function() int.Value = val end) Updated script (it's in a Local script) IntValue is in game.Workspace.Model.Screen, it's called Channel. TextBox is in StarterGui.ScreenGui.Frame Button is in StarterGui.ScreenGui.Frame Script is inside of the button.
|
|
|
| Report Abuse |
|
|
|
| 23 Apr 2014 10:17 PM |
Then the text box would be somewhere else. Also, is the TextBox named 'Text' ?
box = script.Parent.Parent:FindFirstChild("Text") int = Game.Workspace.Model.Screen.Channel Button = script.Parent
Button.MouseButton1Click:connect(function() int.Value = box.Text end)
You cannot associate a variable to a property, only the value the property contains. This may be kind of confusing right now, but hopefully, yhis example will clear it up:
local p = Instance.new("Part")
local n = p.Name p.Name = "Bob" print( n ) --> Part
print( p.Name ) --> Bob
Essentially, the value of all properties of all objects are copied to the variable. This means the variable will NOT change when the property is changed (because the VALUE was copied at the time of retrieval). |
|
|
| Report Abuse |
|
|
|
| 23 Apr 2014 10:23 PM |
| Thank you very much, thank you for explaining that to me. It's working fine. |
|
|
| Report Abuse |
|
|