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

mouse.Target returning nil when it shouldn't?

This by all means shouldn't be happening, this exact script was working yesterday (without me modifying it) and now it doesn't, I don't know if I accidentally messed something up or what. (Also I am not clicking in the sky.) I am just wondering why it isn't returning the actual target.

my script:

local selected = nil

local mouse = game.Players.LocalPlayer:GetMouse()

mouse.Button1Down:Connect(function()
	print("test")
	print(mouse.Target)
	print(selected)
	if not(mouse.Target == selected) then
		
		print("Not")
		selected = mouse.Target
		wait()
		script.Parent.FB.Adornee = selected
		script.Parent.LR.Adornee = selected
		script.Parent.UD.Adornee = selected
		script.Parent.SelectionBox.Adornee = selected
		print(selected)
	else
		print("is")
	end
end)

Any help would be greatly appreciated.

1 answer

Sorry my bad, it turns out setting a target filter in another script effects this one.

1 comment

0

Will you edit the Thread title? it's solved after all , hehe thanks

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