okay so im making this script for my simulator, i want it to print what the player clicked while holding the tool so i can use an if statement like: If Part.Name == “Rock” then ect, but for some reason this simple script wont work, please help!
local tool = script.Parent
local function onActivated()
local mouse = game.Players.LocalPlayer:GetMouse()
local mouseTarget = mouse.Target
if mouseTarget and mouseTarget:IsA("BasePart") then
print(mouseTarget.Name)
end
end
tool.Activated:Connect(onActivated)