Today, i been making a framework but i been having a problem where a variable wasn’t changing at all.
Module Script
local ExpectInstance = {}
function ExpectInstance.CreateElement(InstanceName,Parent,TubTable)
assert(typeof(InstanceName) == "string","Instance Name Is not a Instance")
assert(typeof(Parent) == "table" or "Instance","This is not a Instance or Table")
local AlreadyInstance = nil
if typeof(InstanceName) == "string" and typeof(Parent) == "Instance" and typeof(TubTable) == "table" then
local CreatedInstance = Instance.new(InstanceName,Parent)
for TableIndexName, NewProperties in pairs(TubTable) do
if (CreatedInstance[TableIndexName]) then
CreatedInstance[TableIndexName] = NewProperties
AlreadyInstance = CreatedInstance
print(AlreadyInstance) -- Is value
return CreatedInstance
end
end
end
if typeof(InstanceName) == "string" and typeof(Parent) == "table" and AlreadyInstance ~= nil then
local CreatedInstance = Instance.new(InstanceName,AlreadyInstance)
for TableIndexName, NewProperties in pairs(Parent) do
if (CreatedInstance[TableIndexName]) then
print(AlreadyInstance)
CreatedInstance[TableIndexName] = NewProperties
end
end
end--
end
return ExpectInstance
Local Script
local ExpectInstance = require(game.ReplicatedStorage.ModuleScript)
local Test= ExpectInstance.CreateElement("ScreenGui",game.Players.LocalPlayer.PlayerGui,{
Enabled = true;
Frame = ExpectInstance.CreateElement("Frame",{Size = UDim2.new(1,0,1,0)});
})
im checking to see if AlreadyInstance value has changed for i can parent the value but it returning as nill.