Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I make a tool interact with parts?

Asked by 4 years ago

So I have a tool that is basically an axe and I want to make it so when the player has the tool in their hand, the "fallen log" moves to the set location.

script.Parent.ClickDetector.MouseClick:connect (function(plr)
    local tool = plr.Backpack:FindFirstChild("Axe")
    if tool then
script.Parent.Parent.FallenLog.CFrame = CFrame.new(Vector3.new(0, 0, 0))
end
end)

But this code only makes it if the Axe is in a players inventory. Also when the player has the item in their hand it wont let them click on the log at all. Any solutions?

Answer this question