Hi! I just got started with Roblox scripting a few days ago. I'm trying to make a tool that lets you click on a location and teleport to it. I'm starting it off by trying to print the mouse's location when you use the tool, but nothing happens when I click and I'm not getting any errors. I don't know if I'm going about this in a totally wrong way or if I'm slightly off.
local tpTool = game.StarterPack.TPTool
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
function getMouseCFrame()
local mousePosition = mouse.Hit.p
print(mousePosition)
end
tpTool.Activated:Connect(getMouseCFrame)

2 comments
Please put it as the accepted answer so others know it's resolved
how?