These functions seem to be unable to grab states:
print(states[plr]) -> nil
Although, when I print states[plr] from the SetState function, it returns the wanted text... something that isn't nil / false
All of the listed functions are in the same ModuleScript located in ReplicatedStorage
function module.ReturnStates(plr)
if states[plr] == nil then
return nil
else
return states[plr]
end
end
function module.GetStates(plr, stateKey)
print(states[plr])
if states[plr] then
return states[plr][stateKey]
end
end
Even though States are being set in a function right below them
function module.SetState(plr, stateKey, value, duration)
if not states[plr] then
print("Creating Branch at (states[plr])")
states[plr] = {}
print(states[plr])
end
states[plr][stateKey] = value
print(states[plr])
if duration and type(duration) == "number" then
task.delay(duration, function()
print("Deleted State")
if states[plr] then
states[plr][stateKey] = nil
if next(states[plr]) == nil then
states[plr] = nil
end
end
end)
end
end