Item Disappearing in Backpack

Hello!

I’m creating a tycoon game where players can by weapons, in this case a staff. The script puts the item in a players backpack:
ct4

but no item appears in the toolbar

if moneyAmount.Value >= script.Parent.Cost.Value then
			
			moneyAmount.Value = moneyAmount.Value - script.Parent.Cost.Value
			player.Refund.Value = player.Refund.Value + script.Parent.Cost.Value
		
			for i, child in ipairs(script.Parent.Target.Value:GetChildren()) do
				if child.ClassName == "Part" or child:IsA("BasePart") then

						child.Transparency = 0
					if child.Name ~= 'DropLocation' then
						child.CanCollide = true
					end
					
				end
			end
				
				script.Parent.Target.Value.Parent = player.Backpack

There’s more code, but that’s the only code that directly relates to this issue. I’m getting no errors in the output.

Hope you all are enjoying your day,
@Mithrandir6440

1 Like

First off, just delete all this, you don’t need it.

All that stuff would be for a stationary object in the workspace, not something going into the player’s backpack
Next put the staff in serverStorage.
Then just say

local staffClone = game.ServerStorage.Staff:Clone() --not sure the name of the staff
staffClone.Parent = player.Backpack
1 Like

Hmm, it didn’t work. Same thing happened. The parent is backpack, but no box shows up so I can equip it…

1 Like

Hmm… I’ll check something…

It might not be grabbing the right player for some reason, can you send the whole piece of code?

If you just put the tool into the starter pack does it show up then, is it possible that you disabled the toolbar?

1 Like

Also try printing the player, the staff’s parent, and a print line at the end of all the code you put in the condition, because if that doesn’t print, then you can start working backwards until you locate the problem, if that makes sense…

Alright. I’m resolving never again to post on the devforum without trying really hard first, because its unfair to all of the people that help me and then I end up solving it by myself.

The issue was that the tool wasn’t in a tool format, it was in a model. Thanks to all who helped on this.

1 Like