For the Past I've been trying to figure out and it would be helpful to note that, because my attempts have been unsuccesful which is unfortunate
COMMUNITY QUESTION
How do I script hold f to buy a tool?
1 answer
Can you be more specific? I think this will help?
local item = --your item path here
local player = game:GetService("Players").LocalPlayer
local mouse = player:GetMouse()
mouse.KeyDown:Connect(function(key)
if key == "f" then
wait(2) -- make it how long the holding will be
local clone = item:Clone()
clone.Parent = player:WaitForChild("Backpack")
if player.Character.Humanoid.Health == 0 then
wait(4.75)
local clone = item:Clone()
clone.Parent = player:WaitForChild("Backpack")
--it's basically gives you the item if you died
end
end
end)
or you can just use proximity prompt, learn it on youtube!
local proximitypromt = --your proximity prompt path here
proximityprompt.Triggered:Connect(function()
local item = --your item path here
local player = game:GetService("Players").LocalPlayer
local clone = item:Clone()
clone.Parent = player:WaitForChild("Backpack")
proximitypromot.ActionText = "Bought!"
end)
if none of the above works, then dm me on discord: Blue Duck#9891
(if you have discord)
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
DO NOT USE THIS METHOD. It uses mouse.KeyDown which is a deprecated method. Please use UserInputService instead of this method.
Okay, sir! Thanks for the knowledge! May god bless you!