How do I not repeat code over and over?

Hello, I am wondering how I can not repeat the same code over and over:

script.Parent.Text == "Hello"
local Tween = (Button,Tweeninfo,BackgroundTransparency = 1)
Button.Size = UDim2.new(20,0,20,0)

In another script:

script.Parent.TextColor3 = Color3.new("Dark Blue")
script.Parent.Text == "Welcome to my game!"
script.Parent.Parent.Enabled = false
local Tween2 = (Button,Tweeninfo,TextTransparency)
Button.Size = UDim2.new(20,0,20,0)

Can you can make this code more simple by using module scripts? and would it look like this:

Color = "Dark Blue"
Size = UDim2.new(1,0,1,0)
Position = UDim2.new(0,0,0,0)
T:Create(Obj,Info,{Position = Goal})
2 Likes

Try using a while loop!
Loops (roblox.com)

Also you seem to have put == instead of = in some places… If your trying to set something then you cannot use ==.
image
Operators (roblox.com)

1 Like