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

Help with Mouse.Target only working in a friends game but not mine ;( ?

This is in a local script and the thing that is weird is that.. This script is working my a friends game but not mine, everything is exactly the same!

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local Cow = game.Workspace.Cow

Mouse.Button1Down:connect (function()
	if Mouse.Target.Name == 'Cow' then
		for i,v in pairs(Cow:GetChildren()) do
	   	if v:FindFirstChild('Fire') then
				v:FindFirstChild('Fire'):remove()
			end
		end
	end
end)

1 answer

✓ Accepted answer

If you look at the Mouse's Wiki page, you'll see its Mouse.Targetproperty is a BasePart object, not a Model.

So what's happening here is Mouse.Target gets assigned a part from your model.

Mouse.Target.Parent should give you what you want.

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