How to update leaderstats with a F to pick up inventory system?

Hello, I currently have a functional inventory system that allows a person to pick up items and store them into an inventory system, (Not a backpack). I also have a crafting system that functions off a leader stat basis. The two function differently and I wanted to know how I can link the two so every time you pick up a item you can use it to craft something like a sword. More or less I’d like to know how I could update the leader stats every time you pick up and drop a item.

Put proximityGui (or whatever its called) to the part and put a script inside of it, then just use proximityGui.Activated and use the plr parameter that was passed in that event to updaye the leaderstats

(make sure to delete the part after picking it up)

by saying “not backpack” do you mean not the default ui or ditching out Player.Backpack entirely?
I once tried the latter and quickly realised disabling the GUI was much easier

I was thinking about putting something like that into a remote handler I have, every time you’d pick up an item of a specific type it would update the specific leader stat however one small problem would come to the fact that the leader stat can only hold so many items. Perhaps I have to link the crafting to the inventory system itself? I’m somewhat new to scripting so I am still learning.

--//Services
local Players = game:GetService("Players")

--//Functions
Players.PlayerAdded:Connect(function(player)
	player.MyInventorySystem.ChildAdded:Connect(function(instance)
		print(instance.Name, "has been added.")
		
		--//Change leaderstats
		-- player.leaderstats.Value
	end)
	
	player.MyInventorySystem.ChildRemoved:Connect(function(instance)
		print(instance.Name, "has been removed.")
		
		--//Change leaderstats
		-- player.leaderstats.Value
	end)
end)

What are the leaderstats values so I can help better?

I created a Inventory Gui so every item picked up is stored there.

I’m thinking I have to convert the “backpack” from leaderstats to that of the inventory I made.

What backpack are you talking about? Why is your backpack in leaderstats?

Pardon me I am not exactly familiar with all of this, I am taking a look as to what I am trying to ask of.


These are the details in particular of the script. I have a module script for the details involving the tools mainly the info relating to the cost. I’m thinking, I have to somehow make it so it updates the values I have setup for the inventory.

Try this server script:

--//Services
local Players = game:GetService("Players")

--//Functions
Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		character.ChildAdded:Connect(function(instance)
			if instance:IsA("Tool") then
				print(instance.Name, "has been added.")
			
				--//Change leaderstats
				-- player.leaderstats.Value
			end
		end)

		character.ChildRemoved:Connect(function(instance)
			if instance:IsA("Tool") then
				print(instance.Name, "has been removed.")
			
				--//Change leaderstats
				-- player.leaderstats.Value
			end
		end)
	end)
end)
1 Like

@Katrist
Thanks a ton, Ill be sure to let you know that this works or not. I’m very confident it will seeing that you a programmer have more experience than me an upcoming indie dev!! Thanks so much!