A few questions to help out a clueless beginner?

just a quick question -

Is the variable “pos1” underlined in red, an accurate way (does it work?) to define a coordinate as a variable, to be used in future uses; im lazy to write a whole coordinate, for example to tween a ui label, typically i would do label:Tweenposition(UDim2.new(0.406, 0, 0.25, 0) "Out", "Sine", 0.5, true)
but would it be possible if i had changed the (0.406, 0, 0.25, 0) to “pos1” as stated as a variable instead? it would have saved quite some time from switching to and fro from the properties tab…

  1. is this a legitimate way to code? how should i do it, if not a coordinate but a random value to be used somewhere?

*Additional question not relevant to post: Ive tried printing anything but nothing seems to be working the way i expected in my output. Ive clearly stated a print statement somewhere, just for a random check to see if my code is running, but apparently nothing was outputted. None of my uis are tweening at all, albeit i use the exact same format of codes from a previous project which works exactly fine. (not my main concern in this post tho)

heres part of my script:


-- if label.Visible == false then label.Visible = true
--	if label.Visible == true then
--	if pos == UDim2.new(0.406, 0, 0.45, 0) then -- wait this seems wrong
		
--		task.wait(2.5)
--			local message = "WELCOME"
--			for i = 1 -- this is supposed to be in the later part of the script to make the label fade out, but not relevant to this part, its some accidental rearranging error
--		task.wait(1)

--		label:Tweenposition(UDim2.new(0.406, 0, 0.25, 0) "Out", "Sine", 0.5, true)
--		print("Greetings!")
--		wait(0.1)
--		underline:TweenSize(UDim2.new(0, 200, 0, 2) "In", "Quad", 0.35, true ) -- underlines the welcome text
		
--		task.wait(0.5)
--		if text.Transparency == 1 then
--			text.Text = "Text"
--		end

is it due to the amount of overlapping conditions?

1 Like

Yes, and no. Instead of just Defining a List of Numbers, you can just turn it into a UDim2 Value, or a Vector3 Value:

oldPos1 = {1,0,1,0} -- Array of Numbers
newPos1 = UDim2.new(1,0,1,0) -- UDim2 Value

It would be possible, you just use the unpack function to apply the values:
(Assuming that is what you mean)

local pos1 = UDim2.new(1,0,1,0)
local pos2 = {.5,0,.5,0}

label:TweenPosition(pos1, "Out", "Sine", .5, true) -- normal
label:TweenPosition(UDim2.new(unpack(pos2)), "Out", "Sine", .5, true) -- other way
3 Likes

Yes i meant to write it as a Udim2 value, but somehow i forgot and hastily posted it.

Thanks for taking your time and clarifying my doubts!