generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: CommandScript Help

Previous Thread :: Next Thread 
ScriptsAndStuff is not online. ScriptsAndStuff
Joined: 21 Feb 2013
Total Posts: 264
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
ScriptsAndStuff is not online. ScriptsAndStuff
Joined: 21 Feb 2013
Total Posts: 264
16 Mar 2013 11:56 PM
bump
Report Abuse
ScriptsAndStuff is not online. ScriptsAndStuff
Joined: 21 Feb 2013
Total Posts: 264
17 Mar 2013 12:04 AM
bump
Report Abuse
ScriptsAndStuff is not online. ScriptsAndStuff
Joined: 21 Feb 2013
Total Posts: 264
17 Mar 2013 12:08 AM
bump bump
Report Abuse
ScriptsAndStuff is not online. ScriptsAndStuff
Joined: 21 Feb 2013
Total Posts: 264
17 Mar 2013 12:08 AM
bump bump
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
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
ScriptsAndStuff is not online. ScriptsAndStuff
Joined: 21 Feb 2013
Total Posts: 264
17 Mar 2013 12:14 AM
lol i just sent you a pm.
Report Abuse
ScriptsAndStuff is not online. ScriptsAndStuff
Joined: 21 Feb 2013
Total Posts: 264
17 Mar 2013 12:15 AM
How do i use else if?
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
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
ScriptsAndStuff is not online. ScriptsAndStuff
Joined: 21 Feb 2013
Total Posts: 264
17 Mar 2013 12:35 AM
The problem is that the text will not change how can i fix this?
Report Abuse
ScriptsAndStuff is not online. ScriptsAndStuff
Joined: 21 Feb 2013
Total Posts: 264
17 Mar 2013 12:36 AM
Thats not it the text changes but Ball doesn't move.
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
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
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
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
ScriptsAndStuff is not online. ScriptsAndStuff
Joined: 21 Feb 2013
Total Posts: 264
17 Mar 2013 12:42 AM
Does it matter if ball is a Textlabel?
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
17 Mar 2013 12:43 AM
No, just "Type".

¤ ¤ † K M <( •д• )> X D † ¤ ¤
Report Abuse
ScriptsAndStuff is not online. ScriptsAndStuff
Joined: 21 Feb 2013
Total Posts: 264
17 Mar 2013 12:45 AM
Type is a textbox.
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
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
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
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
ScriptsAndStuff is not online. ScriptsAndStuff
Joined: 21 Feb 2013
Total Posts: 264
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
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
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
ScriptsAndStuff is not online. ScriptsAndStuff
Joined: 21 Feb 2013
Total Posts: 264
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
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
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
ScriptsAndStuff is not online. ScriptsAndStuff
Joined: 21 Feb 2013
Total Posts: 264
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
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
17 Mar 2013 01:05 AM
Glad I could help.

¤ ¤ † K M <( •д• )> X D † ¤ ¤
Report Abuse
ScriptsAndStuff is not online. ScriptsAndStuff
Joined: 21 Feb 2013
Total Posts: 264
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image