Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to get the Parent of Mouse.Target?

I'm trying to find the parent of the mouse.Target but I can't find a way to do it

local players = game:GetService("Players")
local player = players.LocalPlayer
local mouse = player:GetMouse()
local mTar = mouse.Target


mouse.Button1Down:Connect(function()
	print("hi1")
	if mTar.Name == "Hitbox" and player.UserId == mTar.Parent.Parent.PlantOwner.Value then
		print("hello")
	end
end)

Any help would be appreciated!

1 answer

Never mind... found the solution. My variables were messing it up. I had to write mouse.Target instead

1 comment

0

Yes, that was your issue. Upon declaring mTar, it took note of what the mouse was targeting at that very time, it wouldn't renew unless you asked to get the target on clicking.

This discussion is preserved as it was. New answers, comments, and votes are closed.