Why my Code and why Event is not working?

I want to make sure that when I use my “Tool” in game. A part named “Part” looks in the direction of the part named “Part2”.

In the following code I want to use the .Equipped event or .Enable

ttteee

I would like to know what mistakes I made and how to make my code work.

any help would be appreciated !

  1. You are referring to the tool in StarterPack, which is cloned to players backpack when player joins.
  2. Having a while loop like that will cause memory leak and will slow down the server eventually. You don’t need a while loop.

Here is what you should do instead:

game.Players.PlayerAdded:Connect(function(plr)
     local function equipTool()
         Part.CFrame = CFrame.new(Part.Position, Part2.Position)
     end
     plr:WaitForChild("Backpack"):WaitForChild("ToolName").Equipped:Connect(equipTool)
end)