local Manager = {}
data = {};
client = game.ReplicatedStorage.Remotes.ClientServer
ps = game:GetService("Players")
local framework = require(script.Parent)
function Manager:Add(char)
local plr = ps:GetPlayerFromCharacter(char)
if plr then
data[plr.UserId] = framework.new()
else
data[char] = framework.new()
end
end
function Manager:Remove(char)
local plr = ps:GetPlayerFromCharacter(char)
if plr then
data[plr.UserId] = nil
else
data[char] = nil
end
end
function Manager:Retrieve(char)
local plr = ps:GetPlayerFromCharacter(char)
if plr then
return data[plr.UserId]
else
return data[char]
end
end
function Manager:Init()
ps.PlayerAdded:Connect(function(plr)
Manager:Add(plr.Character)
end)
ps.PlayerRemoving:Connect(function(plr)
Manager:Remove(plr.Character)
end)
end
client.OnServerInvoke = function(plr)
return Manager:Retrieve(plr.Character)
end
return Manager
well i take it back that wasn’t the issue but you got my brain working. It was because I’m using oop to do it, I forgot to put return self in the actual module.
Also there was an error that popped up because the char was nil so you did basically help.