Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I make a script that when you touch a part, it equips an item in your backpack?

Asked by
Galicate 106
7 years ago

How would I make a script that when you touch a part, it equips an item in your backpack?

1 answer

Log in to vote
1
Answered by 7 years ago
Edited 7 years ago
01local debounce = false
02 
03script.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
13end)

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

Ad

Answer this question