Roblox News Twitch Roblox News YouTube Roblox News Duck Hunt 2014 Roblox News Egg Hunt 2014 Spotlight of Silence

Friday, July 27, 2012

A Small Scripting Tutorial:

So, a lot of people have been asking me to make a scripting tutorial. I never actually agreed. But people were saying RN were low on some scripting tutorials, so I may continue doing this in the future if people find them helpful.

What is UDim2?
UDim2 is like the CFrame of a gui, with UDim2 you can move guis and manipulate them to your willing. Like Quadratum Havoc, when you press 'Q' a gui flies into the screen. This is one of the great things you can create with the object UDim2.

How do we use UDim2?
UDim2 is actually not that hard to use in the slightest, as long as you have a text button, and a script with a function. You can move it anywhere.

A script involving UDim2:
function ZakaryIsEpic(mouse)
script.Parent.Parent.TextButton.Position =, 0, 0.5, 0)

script.Parent.Parent.TextButton.Position =, 0, 0.6, 0)

script.Parent.Parent.TextButton.Position =, 0, 0.7, 0)

The Function Line: The function line is just the function. (HAS TO HAVE MOUSE)

UDim2, the line would make the TextButton have the position {0.5, 0, 0.5, 0}.

The wait line makes it wait the lowest it can, (wait(0.03)).
The end line ends the function

And the connect line connects the function.

But what if we don't want to write this much?
Well, problem solved, we have the for function...

function ZakaryIsEpic(mouse)
       for i=0.01, 0.5, 0.01 do
              script.Parent.Parent.TextButton.Position =, 0, 0+i, 0)


Instead of writing every line of code to do it, you can just use for. This code would make the textbutton move 0.01 every 0.03 second, and it would move many, many times a second. It would have to move to 0.5, so it would move around 500 times. For can also be used for other things like transparency, but I won't get into detail with that on my first scripting tutorial on ROBLOX News.

I'm Zakary99 and thank for for reading this tutorial.
Want news on my latest projects/posts?
Follow me @RBX_Zakary99

1 comment:

Write your comment here... OR Flingi will eat you