#Proximity prompt to pick up tool, stops when cloned from ReplicatedStorage
4 messages · Page 1 of 1 (latest)
local model = game.ReplicatedStorage.Apple
local function onKeyPress(input)
-- Check if the "E" key was pressed
if input.KeyCode == Enum.KeyCode.E then
-- Unequip the tool from the player
if player.Character:FindFirstChildWhichIsA("Tool") then
player.Character:FindFirstChildWhichIsA("Tool"):Destroy()
stopHoldingAnimation()
local clone = model:Clone()
clone.Parent = workspace
clone.Handle.CFrame = player.Character.PrimaryPart.CFrame
end
end
end
-- Bind the key press event
UserInputService.InputBegan:Connect(onKeyPress)
this is part of a different localscript inside the tool that clones it from replicated storage
proximity prompt script is a normal script, the one for cloning it is a localscript and both are directly under the tool