How would I make a script that when you touch a part, it equips an item in your backpack?
COMMUNITY QUESTION
How would I make a script that when you touch a part, it equips an item in your backpack?
1 answer
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
This discussion is preserved as it was. New answers, comments, and votes are closed.
