For some reason my tool doesn’t work when I click and I have no idea why. Local script inside tool:
local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() script.Parent.Activated:Connect(function() Player.Character:MoveTo(Mouse.Hit.Position) end)
Please help
Make sure your Tool
has a Part
named "Handle"
inside it.
The Activated
event will not fire if the tool's handle is missing, unless you set the RequiresHandle
property of the tool to false
, which you should do if you want your tool not to have any parts which are held by your player.
Instead of Activated
, use Mouse.Button1Down
local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() local Tool = script.Parent local Equipped = false -- to make sure that the tool doesn't activate when unequipped Mouse.Button1Down:Connect(function() if Equipped then Player.Character:MoveTo(Mouse.Hit.Position) end end) Tool.Equipped:connect(function() Equipped = true end) Tool.Unequipped:connect(function() Equipped = false end)