Hi guys, I need to get a parent of the part targeted by the mouse, I tried with something like this:
local player = game.Players.LocalPlayer local mouse = player:GetMouse() function myFunction() if tostring(mouse.Target) == "MyBrick" then local instance = mouse.Target.Parent:FindFirstChild("InstanceID") instance.Value = 15; end end
But that wont work, why?
Not too sure why that didn't work, but gonna try to put my hand on it:
local player = game.Players.LocalPlayer local mouse = player:GetMouse() function myFunction() if mouse.Target then if mouse.Target.Name == "MyBrick" then local instance = mouse.Target.Parent:FindFirstChild("InstanceID") instance.Value = 15; end end end
Also I hope you do call that function somewhere.