Dragoloy
|
  |
| Joined: 02 Nov 2012 |
| Total Posts: 252 |
|
|
| 03 Oct 2015 10:20 PM |
This is my third question in Scripters today. I appreciate the help I've received so far. Thanks!
How can I index a variable in UDim2? I'm trying to do this:
local UDim2 = 0.4
while wait() and UDim2 > 0.05 do UDim2 = UDim2 - 0.01 textlabel.Position = UDim2.new(0.24,0,UDim2,0) end
When I ran this, it didn't work. The output said, "attempt to index 'Udim2', a number value," or something along those lines. Thanks in advance.
~Dragoloy, President of Drago Inc.~ |
|
|
| Report Abuse |
|
|
|
| 03 Oct 2015 10:21 PM |
Rename your UDim2 variable to something else like
local UDim2YScale = 0.4 |
|
|
| Report Abuse |
|
|
|
| 03 Oct 2015 10:22 PM |
Maybe use a different variable name.
local yScale= 0.4
while wait() and yScale> 0.05 do yScale= yScale - 0.01 textlabel.Position = UDim2.new(0.24,0, yScale, 0) end
Or just use a for loop:
for i = .4, .05, -.01 do textlabel.Position = UDim2.new(0.24, 0, i, 0) end
-The [Guy] |
|
|
| Report Abuse |
|
|
|
| 03 Oct 2015 10:23 PM |
Forgot the wait()
for i = .4, .05, -.01 do textlabel.Position = UDim2.new(0.24, 0, i, 0) wait() end
-The [Guy] |
|
|
| Report Abuse |
|
|
Dragoloy
|
  |
| Joined: 02 Nov 2012 |
| Total Posts: 252 |
|
|
| 03 Oct 2015 10:23 PM |
Yeah, the problem was the variable name lol. Thanks!
~Dragoloy, President of Drago Inc.~ |
|
|
| Report Abuse |
|
|
|
| 03 Oct 2015 10:23 PM |
I still suggest you use the for loop :3
-The [Guy] |
|
|
| Report Abuse |
|
|
Dragoloy
|
  |
| Joined: 02 Nov 2012 |
| Total Posts: 252 |
|
|
| 03 Oct 2015 10:33 PM |
Yeah, that for loop worked well. Thank you!
~Dragoloy, President of Drago Inc.~ |
|
|
| Report Abuse |
|
|