I’m looking to create a system where BoolValues are loaded into a folder inside the player, and a UI is changed depending on the result, so for example, if ___ value is set to true, ___ frame becomes visible, etc.
The issue I’m facing however is the local script does not recognize the folder at all. I tried fixes such as referencing the folder in the server script, but each time returns with a similar error:
The datastore is not the problem, the values save, the RemoteEvent fires, but I can’t get it to reference the folder stored inside the player.
Server Script:
local function onPlayerJoin(player)
local Inventory = Instance.new("Folder")
Inventory.Name = "Inventory"
Inventory.Parent = player
local money = Instance.new("BoolValue")
money.Name = "ExampleNametag"
money.Parent = Inventory
local exp = Instance.new("BoolValue")
exp.Name = "ExampleParticle"
exp.Parent = Inventory
local playerUserId = "Player_" .. player.UserId
local data = playerData:GetAsync(playerUserId)
if data then
money.Value = data['ExampleNametag']
exp.Value = data['ExampleParticle']
else
money.Value = false
exp.Value = false
end
game.ReplicatedStorage.valuesDoneLoading:FireClient(player)
print("event fired")
end
Local Script:
game.ReplicatedStorage.valuesDoneLoading.OnClientEvent:Connect(function(player)
if player.Inventory.ExampleParticle.Value == true then
script.Parent.Text = "You own the item!"
end
end)