i want to make a gun game! i dont now how to make a drop and pick up gun script! I really need your support
Hello drbanana2go! To pick up a tool: insert a Script
in the tool and place this:
local debounce = false function getPlayer(humanoid) local players = game.Players:children() for i = 1, #players do if players[i].Character.Humanoid == humanoid then return players[i] end end return nil end function onTouch(part) local human = part.Parent:findFirstChild("HumanoidRootPart") if (human ~= nil) and debounce == false then -- When the player touches the part, it will execute the following script. debounce = true local player = getPlayer(human) if (player == nil) then return end script.Parent:clone().Parent = player.Backpack --Copy the tool inside the Backpack wait(2) debounce = false end end script.Parent.Parent.Touched:connect(onTouch)
Also to drop a tool: click on backspace in your keyboard.
There is a property of the tool called CanBeDropped, set that to true and use backspace to drop. Whenever the tool is dropped, you simply touch it to pick it up.