For some reason my tool doesn’t work when I click and I have no idea why. Local script inside tool:
1 | local Player = game.Players.LocalPlayer |
2 | local Mouse = Player:GetMouse() |
3 | script.Parent.Activated:Connect( function () |
4 | Player.Character:MoveTo(Mouse.Hit.Position) |
5 | 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
01 | local Player = game.Players.LocalPlayer |
02 | local Mouse = Player:GetMouse() |
03 |
04 | local Tool = script.Parent |
05 | local Equipped = false -- to make sure that the tool doesn't activate when unequipped |
06 |
07 | Mouse.Button 1 Down:Connect( function () |
08 | if Equipped then |
09 | Player.Character:MoveTo(Mouse.Hit.Position) |
10 | end |
11 | end ) |
12 |
13 | Tool.Equipped:connect( function () Equipped = true end ) |
14 |
15 | Tool.Unequipped:connect( function () Equipped = false end ) |