|
| 16 Mar 2013 11:50 PM |
local find = script.Parent.Parent
script.Parent.MouseButton1Click:connect(function() if string.lower(find.Type.Text) == "MoveTo1" then wait(1)
find.MainFrame.Ball.Position = UDim2.new(0, 60, 0, 90)
end end)
script.Parent.MouseButton1Click:connect(function() if string.lower(find.Type.Text) == "MoveTo2" then wait(1)
find.MainFrame.Ball.Position = UDim2.new(0, 190, 0, 90)
end end)
script.Parent.MouseButton1Click:connect(function() if string.lower(find.Type.Text) == "MoveTo3" then wait(1)
find.MainFrame.Ball.Position = UDim2.new(0, 60, 0, 250)
end end)
script.Parent.MouseButton1Click:connect(function() if string.lower(find.Type.Text) == "MoveTo4" then wait(1)
find.MainFrame.Ball.Position = UDim2.new(0, 190, 0, 250)
end end)
script.Parent.MouseButton1Click:connect(function() if string.lower(find.Type.Text) == "MoveToC" then wait(1)
find.MainFrame.Ball.Position = UDim2.new(0, 115, 0, 155)
end end)
This is a commandgui script, the commands are MoveTo1, MoveTo2, MoveTo3, MoveTo4, and MoveToC, the problem is that the object called Ball does not move to the designated area. No output.
|
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
| |
|
|
| 17 Mar 2013 12:13 AM |
Are they all in the same script? Try using elseif, for each of the conditions.
¤ ¤ † K M <( •д• )> X D † ¤ ¤ |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 17 Mar 2013 12:17 AM |
You would use it alongside if statements:
script.Parent.MouseButton1Click:connect(function() if string.lower(find.Type.Text) == "MoveTo1" then Wait(1) find.MainFrame.Ball.Position = UDim2.new(0, 60, 0, 90) elseif string.lower(find.Type.Text) == "MoveTo2" then wait(1) find.MainFrame.Ball.Position = UDim2.new(0, 190, 0, 90) --etc end end)
¤ ¤ † K M <( •д• )> X D † ¤ ¤ |
|
|
| Report Abuse |
|
|
|
| 17 Mar 2013 12:35 AM |
| The problem is that the text will not change how can i fix this? |
|
|
| Report Abuse |
|
|
|
| 17 Mar 2013 12:36 AM |
| Thats not it the text changes but Ball doesn't move. |
|
|
| Report Abuse |
|
|
|
| 17 Mar 2013 12:36 AM |
I don't see any reason why the text wouldn't change, it's a TextBox, correct?
¤ ¤ † K M <( •д• )> X D † ¤ ¤ |
|
|
| Report Abuse |
|
|
|
| 17 Mar 2013 12:39 AM |
"Ball" should move as well. Are you sure you typed the correct text exactly? With correct capitalization? If you don't wan't to worry about capitalization, you can use the string.lower() or string.upper() methods.
¤ ¤ † K M <( •д• )> X D † ¤ ¤ |
|
|
| Report Abuse |
|
|
|
| 17 Mar 2013 12:42 AM |
| Does it matter if ball is a Textlabel? |
|
|
| Report Abuse |
|
|
|
| 17 Mar 2013 12:43 AM |
No, just "Type".
¤ ¤ † K M <( •д• )> X D † ¤ ¤ |
|
|
| Report Abuse |
|
|
| |
|
|
| 17 Mar 2013 12:46 AM |
Is Type's text exactly any of the strings? With correct capitalization? If so, it all should be working.
¤ ¤ † K M <( •д• )> X D † ¤ ¤ |
|
|
| Report Abuse |
|
|
|
| 17 Mar 2013 12:48 AM |
Oh, wow, I completely missed you using string.lower! All of the strings you're checking should be LOWERCASED. Because string.lower would make your text all lowercase, and that can never equate to strings that have uppercase letters.
¤ ¤ † K M <( •д• )> X D † ¤ ¤ |
|
|
| Report Abuse |
|
|
|
| 17 Mar 2013 12:48 AM |
| 'Type's text is 'Type Command here...' but when you click on it, it removes the text. |
|
|
| Report Abuse |
|
|
|
| 17 Mar 2013 12:49 AM |
script.Parent.MouseButton1Click:connect(function() if string.lower(find.Type.Text) == "moveto1" then Wait(1) find.MainFrame.Ball.Position = UDim2.new(0, 60, 0, 90) elseif string.lower(find.Type.Text) == "moveto2" then wait(1) find.MainFrame.Ball.Position = UDim2.new(0, 190, 0, 90) elseif string.lower(find.Type.Text) == "moveto3" then wait(1) find.MainFrame.Ball.Position = UDim2.new(0, 60, 0, 250) elseif string.lower(find.Type.Text) == "moveto4" then wait(1) find.MainFrame.Ball.Position = UDim2.new(0, 190, 0, 250) elseif string.lower(find.Type.Text) == "movetoc" then wait(1) find.MainFrame.Ball.Position = UDim2.new(0, 115, 0, 155) end end)
¤ ¤ † K M <( •д• )> X D † ¤ ¤
|
|
|
| Report Abuse |
|
|
|
| 17 Mar 2013 12:57 AM |
YES!!!
How would i make it if the text does not equal any of the commands then a thing becomes visible
ex:
else
script.Parent.Parent.e1.Visible = true |
|
|
| Report Abuse |
|
|
|
| 17 Mar 2013 12:59 AM |
Simply tack on a "else" and the code.
script.Parent.MouseButton1Click:connect(function() if string.lower(find.Type.Text) == "moveto1" then Wait(1) find.MainFrame.Ball.Position = UDim2.new(0, 60, 0, 90) elseif string.lower(find.Type.Text) == "moveto2" then wait(1) find.MainFrame.Ball.Position = UDim2.new(0, 190, 0, 90) elseif string.lower(find.Type.Text) == "moveto3" then wait(1) find.MainFrame.Ball.Position = UDim2.new(0, 60, 0, 250) elseif string.lower(find.Type.Text) == "moveto4" then wait(1) find.MainFrame.Ball.Position = UDim2.new(0, 190, 0, 250) elseif string.lower(find.Type.Text) == "movetoc" then wait(1) find.MainFrame.Ball.Position = UDim2.new(0, 115, 0, 155) else script.Parent.Parent.e1.Visible = true end end)
¤ ¤ † K M <( •д• )> X D † ¤ ¤ |
|
|
| Report Abuse |
|
|
|
| 17 Mar 2013 01:04 AM |
Thanks to you i have accomplished one of my goals.
This GUI could be used for many things. |
|
|
| Report Abuse |
|
|
|
| 17 Mar 2013 01:05 AM |
Glad I could help.
¤ ¤ † K M <( •д• )> X D † ¤ ¤ |
|
|
| Report Abuse |
|
|
|
| 17 Mar 2013 01:12 AM |
Here is a free copy of it i would be very glad if you take it.
http://www.roblox.com/CommandGui-item?id=109801828 |
|
|
| Report Abuse |
|
|