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
6 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 6 years ago
Edited 6 years ago
local debounce = false

script.Parent.Touched:connect(function(hit)
    if hit.Parent:FindFirstChild('Humanoid') then
        if not debounce then
            debounce = true
            local player = game.Players:FindFirstChild(hit.Parent.Name)
            game.ReplicatedStorage.ItemNameHere:Clone().Parent = player.Backpack
            wait(1)
            debounce = false
        end
    end
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

Ad

Answer this question