Heres the script:
--Example
local function getProp(obj, prop)
local getPropVar = obj[prop]
return getPropVar
end
while wait() do
for i,v in next, game:GetDescendants() do
local Transparency = pcall(function() getProp(v, "Tranparency") end) --The part that lags (from what im thinking)
if Transparency then
Tranparency = 1
end
end
end
Its pretty simple. Incase if you dont understand, its supposed to get every object in game and then check if the object has Transparency property. And if it does, it sets it to 1. So the problem is pcall(from what im guessing) since it lags the server. Ive tried adding a wait() to the for loop. it works but it makes the loop really really slow cause of pcall. It cuts it and then plays it back after a few seconds and then cuts it again.
Is there any fix to this?

4 comments
you should use ipairs and pairs instead of next()
This makes the game lag because of the pcall you're creating a function everytime.
also line 13 you spelt "transparency" wrong
MarkedTomato is there anyway to fix it?