Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

: attempt to index global 'Udim2' (a nil value) Why?

Asked by 10 years ago

So i'm trying to get my gui to tween it's size to 25x25 pixels using :TweenSize. My only error is" : attempt to index global 'Udim2' (a nil value)"

The error is on line 10 but I would assume it would be on line 13 too. The object I am tweening is a frame with an image button inside of it. (I know that the image won't tweensize with it so I will be doing that when I get this thing figured out.)

open = true
function Toggle()
m = script.Parent.Parent.Parent:GetChildren()
if open == true then
for i = 1,#m do
m[i].Visible=false
end
script.Parent.Parent.Visible=true
wait(.1)
script.Parent.Parent:TweenSize(Udim2.new(0,25,0,25), "Out" , "Quad", 15)
open=false
elseif open == false then
script.Parent.Parent:TweenSize(Udim2.new(0,200,0,200),"Out","Quad", 15)
open=true
for i=1,#m do
m[i].Visible=true
end
end
end

script.Parent.MouseButton1Click:connect(Toggle)

Help please?

1 answer

Log in to vote
3
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
10 years ago

Names are case sensitive.

The constructor is UDim2.new, not Udim2.new.


Since there's no such thing as a Udim2, it is nil. You are asking for the "new" index on it, hence, "attempting to index a nil value".

Ad

Answer this question