So for some reason Mouse.Target doesn’t work, if I try waiting for the child using the variable local player = game.Players:WaitForChild("LocalPlayer") it still doesn’t work? Anyways, here’s the script.
local Tool = script.Parent local player = game.Players:WaitForChild("LocalPlayer") local mouse = player.Mouse
Tool.Activated:Connect(function() if mouse.Target then mouse.Target:Destroy() end end)
Tool.Equipped:Connect(function() if mouse.Target then mouse.Target.BrickColor = Color3.fromRGB(210, 0, 0) mouse.Target.Transparency = 0.5 end end)
It still doesnt work if I try that, I tried changing it to game.Players.LocalPlayer and with the player:GetMouse(), still doesn’t work, I tried it with waitforchild and says possible infinite yield and doesn’t delete anything when i click (activated), neither when i hover over an object (equipped).
I’m not with my pc right now, so I can’t test it, but let’s try the basics:
-- LocalScript
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
mouse.Button1Down:Connect(function()
print(mouse.Target and mouse.Target:GetFullName())
end)