How to add or remove gear to a player

I’m having some issues with adding or removing gears from players inventory…
I tried relocating the gear from a folder named “Unused” in StarterPack to the main StarterPack, But it still not adding the gear to the player inventory.

2 Likes

hi, i can help u but u need to give more details! if u want to destroy it in a local script the put this line in you’r local script

game.Players.LocalPlayer:FindFirstChild(“BackPack”):FindFirstChild(“UR ITEM NAME”):Destroy()

in a script is harder but if u want in a normal script u can detect by hit, playeradded, region3 and remote event

hit:
(put this script in a part)
script.Parent.Touched:Connect(function(hit)
local player = game.Players[hit.Parent.Name]
— do stuf
end)

playeradded:
game.Players.PlayerAdded:Connect(function(plr)
plr.BackPack:FindFirstChild(“UR ITEM NAME”):Destroy
end)

i dont know at region3 sorry

1 Like

can you please provide more information on what you are trying to achieve? Thanks

1 Like

I’m just writing a code for you just hold on please

1 Like

I am just trying to make a simple store GUI in game…
When a player buys a weapon, He will get the weapon he bought.
Putting the gear I want to give the player in StarterPack will give the player the weapon right when he joines the game…

1 Like

I’m not sure you understood me, I don’t want to destroy the gear the player has. I want to disable or enable it, So when the player buys a new weapon, The new weapon will be added to the player inventory, Or when the player sells a weapon, It will be disabled and removed from his inventory.

1 Like

but thats datastores, you need a datastore to save that value as well then ,would you like me to help you with that then?
–EDIT
for that you would not only need datastore but also a script handling everything you just said, but i’ll try ,i’ll take 20 minutes, you will need to put the local script into every button, along with changing the values then

I will get back to you but it might take a lot of time, but comeback whenever you’ve got time and i’ll probably have done it by then.(I dont know why the text got large)

2 Likes

Yes, I also need some help with datastores. Thank you!

1 Like

Is it ready yet?
Right now I just need help with disabling or enabling gear that are on the player’s backpack…

1 Like

Actually I was still scripting just now , everything’s great-but I encountered a small issue with tables I posted, due to making this actually. I needed this for my game too, so I’ve been doing this for a while but whenever i’m done I will definitely post it here.
edit* = the datastore is complete with tool saves and leaderboard data , but i’m making this as efficiently as possible and functional that is.