How would I make a script that when you touch a part, it equips an item in your backpack?
01 | local debounce = false |
02 |
03 | script.Parent.Touched:connect( function (hit) |
04 | if hit.Parent:FindFirstChild( 'Humanoid' ) then |
05 | if not debounce then |
06 | debounce = true |
07 | local player = game.Players:FindFirstChild(hit.Parent.Name) |
08 | game.ReplicatedStorage.ItemNameHere:Clone().Parent = player.Backpack |
09 | wait( 1 ) |
10 | debounce = false |
11 | end |
12 | end |
13 | end ) |
In the spot where is says ItemNameHere put the name of your item
Also make sure that the item you are giving is in ReplicatedStorage
You don't need this in a localscript you can just use a regular script