Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

can you help me how to make a drop and pick up gun script?

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

2 comments

0

If its a tool, you should be able to just drop it by pressing backspace.

0

can you help us by posting your scripts?

2 answers

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.

2 comments

0

bad answers 101

0

xd

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.