Lately I have had an issue while trying to create tables inside of module scripts. If I change a table with a function and print the table inside the function the table will print out with the new elements. But if I do the same with another function it prints nothing;
local module = {}
local deads = {}
local confirmed = script.Confirmed
local d = script.Death.Value
local ts = game:GetService("TweenService")
function module.Initiate()
spawn(function()
--while not deads do task.wait() end
task.wait(.1)
print("initiated")
print(deads)--prints {} without any elements for some reason
if #deads == 0 then
print("NO DEAD BODIES FOUND")
else
end
script.Parent.Enabled = true
local sizegoal = {}
sizegoal.Size = UDim2.new(1,0,1,0)
d.Dead.Size = UDim2.new(5,0,5,0)
if #deads > 0 then
d.Dead.Dead.Visible = true
d.Dead.NoDeaths.Visible = false
for i, v in pairs(deads) do
local img = game.Players:GetUserThumbnailAsync(v.UserId, Enum.ThumbnailType.AvatarBust, Enum.ThumbnailSize.Size100x100)
local plr = script.DeadPlayer:Clone()
plr.Icon = img
plr.Name = v.Name
end
print("wassup dead people?")
else
d.Dead.Dead.Visible = false
d.Dead.NoDeaths.Visible = true
end
--task.wait(1.5)
local twenfo = TweenInfo.new(2, Enum.EasingStyle.Circular, Enum.EasingDirection.In)
ts:Create(d.Dead, twenfo, sizegoal):Play()
end)
end
function module.setDeaths(t:{Player})
deads = t
print("DEAD?", t, deads)--prints my name (im "dead")
confirmed.Value = true
end
return module
I checked the order by printing stuff out and the functions play in the correct order (first setDeaths() then initiate())
There are no errors