Humanoid.TargetPoint returning origin only

I am just wanting to verity, if anyone else is getting this problem, or if it something on my end.

My game contains a gun, which used to work fine, FE and all that. However, recently it has stopped firing in the correct direction.

So I dug into the code (Roblox default code, the gear came with) and I see it is getting the aim position by using Humanoid.TargetPoint to determine where the user has clicked on the screen (as described in the wiki)

So I reduced all the code down to the core concept of this. I have a generic tool with a server script which contains…

local Tool = script.Parent;

enabled = true

function onActivated()
	if enabled then
		enabled = false
		if Tool.Parent and Tool.Parent:FindFirstChild("Humanoid") then
			local character = Tool.Parent
			local humanoid = character:FindFirstChild("Humanoid")
			local targetPos = humanoid.TargetPoint
			print(targetPos)
		end
		enabled = true
	end
end

script.Parent.Activated:connect(onActivated)

With this, when I click somewhere it prints 0,0,0

So considering this started happening with no change to the original weapon, does that mean I need to make an error report, as the wiki does not state that this method is deprecated?

I need to add, that this DOES work correctly in a Client Script, but as the original weapon code uses is it in a Server Script, and the wiki doesn’t specify that it is Client Only, does that still constitute as an error, or maybe the wiki just needs updating?

2 Likes

I could be wrong about this, so don’t bank on my word.

I’m quite sure that the primary issue you’re experiencing is that Humanoid.TargetPoint isn’t replicating, since it has to be set by the client in the first place as per detecting input.

You’ll probably want to seek a post out on #platform-feedback:documentation-requests regarding this property to be explained or touched up on.

2 Likes

If you want to bring back Humanoid’s TargetPoint property you should use Input Gateway by Clonetrooper1019:
https://www.roblox.com/library/1044101630/Input-Gateway?ViewInBrowser=true&CreatorId=2032622&SearchId=BA8DCE0E-6EE9-48C2-A1A1-4EDF42CD7F19&Category=Model&Position=1&SearchKeyword=input+gateway&CreatorType=User&SortType=Relevance

I’m experiencing the same issue, though with a single tool across two games. It works in one place, but not in the other, but no code changes. Makes me think maybe there’s some type of place setting that’s breaking TargetPoint functionality.

Seems like it may be a client-server disparity looking a little bit closer, though I’m not sure why one is replicating the changes across while the other isn’t, though my intuitive guess is client changes to the TargetPoint stop replicating to the server once an intentional change is made to one but not the other. The game where it’s not working has a much larger codebase, so something like this may be happening there while not in the other (simpler) game.