Find property of a guiObject

here’s the code

for _, element in ipairs(Descendants) do
		local propertiesToTween = {}

		if element:IsA("Frame") then
			propertiesToTween.BackgroundTransparency = 1
		elseif element:IsA("TextLabel") then
			propertiesToTween.TextTransparency = 1
		elseif element.Transparency ~= nil then
			propertiesToTween.Transparency = 1
		else
			continue
		end

		game.TweenService:Create(element, TweenInfo.new(0.5), propertiesToTween):Play()
	end

image
im trying to tween the transparency of a ui that has it

1 Like

Replace line 65, with; elseif element["Transparency"] then

2 Likes

still produces the same error …

For properties they will fail if they don’t exist - it doesn’t work like a table. Try using typeof instead of checking if Transparency exists.

1 Like

sadly it didnt work (producing the same error as the image shown)
image

1 Like
local suc, transparency = pcall(function()
         return element.Transparency
end)

if suc then
       print(transparency);
end
4 Likes

I meant checking the class of the original object

typeof(element)

or

element:IsA("replace this")

thx it works now and not throwing any errors

elseif pcall(function() return element.Transparency end) then

Shorter version:

if element["Transparency"] then
1 Like


if i use this i get the same exception hit as before

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.