Edit: Added time since account created :>
I’ve been working on this since yesterday to improve my UI scripting & tweening.
I didn’t know where to put it, sorry!
This is amazing! How did you do all this! Truly, I have been trying to figure out GUI, and this stuff is the kind of stuff I need.
That’s a good beginning, nice!
For the Hover button, I recommend putting the MouseLeave
function inside of the MouseEnter
function, since it can bug out your button and make it say “Hovered!” even though you moved your mouse away!
Well, for the hover I just used MouseEnter
and MouseLeave
, and :lerp()
.
For the count I used MouseEnter
, MouseLeave
, and just some simple count = count + 1
.
For the tween I just used :TweenSizeAndPosition()
aswell as some other incredibly easy things, and for the click color fade it uses :lerp()
.
Creation date & Time since creation are very easy to set up as they just use os
and simple math
If you’d like me to give you the code for something I’d happily do so. (I’ll give you a complete explanation too)
Totally optional to do transitions however you want, however I’d recommend using the universal tween method as you can tween the same properties and more, all at the same time.
I personally use my own tween function to make it easier to use *(because writing out the full tween function is a bit annoying to do and remember):
local T = game:GetService('TweenService')
function tween(o,t,l,s,d)
s = s or Enum.EasingStyle.Linear
d = d or Enum.EasingDirection.InOut
local i = TweenInfo.new(l,s,d)
return T:Create(o,i,t)
end
tween(<instance>,<property dictionary>,<tween time>,<tween style [optional]>,<tween direction [optional]>)
tween(part,{Transparency=1,Color=Color3.new()},3):Play()
I’m sorry, this is so confusing since I’m extremely new to programming & just barely know UIs
I didn’t mean to overwhelm you, my apologize. You don’t need to use it if it’s too much right now.
But I’ll try to explain it anyway. The code at the top isn’t something you need to understand for it to work, it’s just defining the function. The middle code shows that type of datatype you’d put there. The bottom code is an example of how it would look with actual code.
So for tweening a frame, for example, it would be something like:
tween(frame,{Size=UDim2.new(.5,0,.5,0)},1.5):Play()
But again, don’t feel like you need to do anything like this just yet. Though if you do have any specific questions, feel free to ask.
That piece of code looks evil. Seriously though, what’s a datatype and how do I configure it?
A datatype is like a value of sorts. If you look at any instance, you’ll see a property called “ClassName”. Every object within the explorer is an instance. There are also values like numbers, strings, and some slightly more complex ones like Vector3, UDim2, or even Enums and arrays. Basically, it just means the type of value you pass through.
A function is like a variable, but for chunks of code. Here’s an example of defining a function:
function myCustomPrintFunction(thingToPrint)
print(thingToPrint)
end
myCustomPrintFunction('hello world')
Output:
hello world
Pretty useless function, but that’s just an example of how you’d write one.
So in said function, thingToPrint
would be the datatype?
Well the datatype is a string, because text is a string value.
thingToPrint
is just the argument or variable.
So when calling the function, I put the string value of hello world
. That then got passed to the actual function. Now you can have any number of arguments, and they’ll show up in the order you wrote them in. So thingToPrint
becomes the string value of hello world
.
Feel free to DM me if you have any other questions (so we don’t clutter this thread too much).
I’ve never heard of :lerp()
I will have to learn it! Thank you.
Here’s a quicky: :lerp()
returns a Color3 interpolated between two Color3 objects.
Lerp can actually work with any special value that can be transitioned. It will work with Color3, CFrame, Vector3, UDim2, etc.
Use:
value:Lerp(sameValueType,percentage)
Example:
Vector3.new(0,0,0):Lerp(Vector3.new(0,2,0),.5)
Result:
Position of (0,1,0)
So that basically takes the first value and transitions it toward the second value, but at the percentage you give it (0-1), so 0.5
would make it 50% or half way between.