*I already tried myself, did not work. and I did consult API documentation. Video: https://www.youtube.com/watch?v=FT_gkNI11TY
I am able to press Right click on my mouse and hold the object I want, But I want to configure it to pick the object up by pressing 'E' instead.
Script:
local tool = script.Parent local bridge = tool:WaitForChild("Bridge")
local function onButton2Down() bridge:FireServer("StartPull") end
local function onButton2Up() bridge:FireServer("StopPull") end
local function onEquipped(mouse: Mouse) local character = tool.Parent local lastTarget, lastPos
local function onMouseIdle()
local pos = mouse.Hit.Position
local target = mouse.Target
if target and target:IsGrounded() then
target = nil
end
if target ~= lastTarget then
bridge:FireServer("SetTarget", target)
lastTarget = target
end
if not lastPos or (pos - lastPos).Magnitude > 0.1 then
lastPos = pos
bridge:FireServer("SetTargetPoint", pos)
end
end
mouse.TargetFilter = character
mouse.Idle:Connect(onMouseIdle)
mouse.Button2Down:Connect(onButton2Down)
mouse.Button2Up:Connect(onButton2Up)
end
tool.Equipped:Connect(onEquipped)
