There are probably a lot more to come with my Universal Inventory Script, but right now I just need to focus on one issue. Cloning the Inventories into the proper places. There are two types of Inventories, inventory; located in player, & carrierInventory; located in character.
inventory clones into player but carrierInventory doesn't clone into the character. The Script is also supposed to dispose of itself once finished cloning, it appears it's a silent output issue judging by the Script obviously not following through with the disposal command, of which isn't interrupted by anything.
I can't seem to find the issue, can you?
Players.simplealgorithm.PlayerScripts.pickUpItem:46: attempt to index upvalue 'carrierInventory' (a nil value)
I moved the parent to starterCharacter and I got this
'Something unexpectedly tried to set the parent of setInventories to NULL while trying to set the parent of setInventories. Current parent is carrierInventory.'?
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:wait()
if (character) then
local inventory = script:FindFirstAncestor("inventory")
local carrierInventory = inventory:WaitForChild("carrierInventory")
if not player:FindFirstChild("inventory") then
inventory:Clone().Parent = player
player:FindFirstChild("inventory"):ClearAllChildren()
elseif not character:FindFirstChild("carrierInventory") then
carrierInventory:Clone().Parent = character
character:FindFirstChild("carrierInventory"):ClearAllChildren()
end
end
script:Destroy()
Thanks!

16 comments
u dont have to check for player; local player will never be nil as long as its in a local script. you also dont have to check for character, bc
:Wait()will make the script yield until character is found, kinda like:WaitForChild()therefore, it will never be nil if the script continues.It's my decision, it's also important if the Character exists because it's mainly based of the Character, so I'd be happy to yield it until it exits
also didn't fix the issue
but i'll edit it so it doesn't check for the player you're right there
i know its ur decision, but ur decision should be to make ur code as efficient as possible. the character will always exist, so that if statement is completely pointless
I know, but It's called being cautious, if someone exploits and removes a character, then what happens?
Anyway, could you help me fix this?
I posted the error
Its their fault for exploiting. Forget them.
You should also post some full code, as this is not what an upvalue is. An upvalue is an external local variable declared outside of a function body. This is not a function body.
I'm just as confused rn
This is the full code
Oh, hmm
It's in the other Script, I fixed a syntaxing issue, but it was right, it can't find it because it's not in character, it wasn't cloned
So this is a silent output issue
I'm bad at those