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

how do i add a delay to tool pickup?

i want to make a pickupable pizza, s i put the pizza parts in a tool container and welded everything together but when i pressed backspace to drop the tool it immediately picked it up again. i tried adjusting grippos in the properties but nothing worked without the pizza just hanging above my character. is there any way i can use a script, if so i hope this script template would help you.

local tool = script.Parent
 
local function onEquip()
end
 
local function onUnequip()
end
 
local function onActivate()
end
 
local function onDeactivate()
end
 
tool.Equipped:Connect(onEquip)
tool.Unequipped:Connect(onUnequip)
tool.Activated:Connect(onActivate)
tool.Deactivated:Connect(onDeactivate)

2 comments

0

Add a wait and a debouce

0

where in the script???????

1 answer

local tool = script.Parent
local debounce = true

local function onActivate()
end
if debounce then
wait(1)
debounce = false
end
end

local function onDeactivate()
end
debounce = true
tool.Activated:Connect(onActivate)
tool.Deactivated:Connect(onDeactivate)

1 comment

0

wasn't the thing i was asking for but doesn´t matter anymore

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