Literally cant do anything ever without this error. And i don't know what causes it

Hello everyone. I’m a bit peeved today. I always get this error when trying to script. It happens to multiple different things


image

So i get this error and add a print.

image
And then i get this


Now my spawn location is pretty small. And this only pops up when i click on the dummy i’m using.

image
These are clearly pretty far away from eachother. And should NOT be causing any issues right?
I just can’t seem to get it to do any thing. Please help me out here.

EDIT

This is only one situation out of several.

EDIT 2

Failed to mention that this is a Local Script. My apologies.

2 Likes

Could you try adding game.Players.LocalPlayer.Character:MoveTo(target)? If that doesn’t work try doing target.Position.

1 Like

Well That isn’t the issue i’m trying to fix. Take a look at the first image. The error occurs on line 16. Which is local chr = target.Parent

Meaning I cant even get to the main script because it just gives me an error before it starts.

1 Like

Right, but if I am correct, mouse.Target returns the position, not the item which the mouse is pointing at.

1 Like

Oh. Alright well what do i use for the item the target the mouse is pointing at?
I’ll try what you have posted above RQ

1 Like

Apologies, I guess I was wrong, I tried it just now. Are you ever moving your cursor to the sky or onto the terrain? It returns nil unless you’re pointing at a part.

mouse.Target returns the object not position.

1 Like

New ERROR image

1 Like

I’m Just clicking on the TORSO of the dummy.

1 Like

Hold on, let me replicate what you are doing. Just to be clear, you want to return the torso of the dummy, correct?

Well my end goal is to have a script where when I click on a player (Or Dummy.) and my player looks at them. Waits a second or two then shoots them. A replication of The ISLE’s firearm system.

1 Like

I think I see your problem. In your code, you have if mouse.Target and mouse.Target.Parent:FindFIrstChild('Humanoid'), you should check first for mouse.Target, and if mouse.Target exists, then make a separate if statement checking for the humanoid.

So split what i Already have?

1 Like

Yeah, exactly. Just split it into two separate if statements. I’ll provide a code sample:

while true do
	if game.Players.LocalPlayer:GetMouse().Target then
		if game.Players.LocalPlayer:GetMouse().Target.Parent:FindFirstChild('Humanoid') then
			print('Humanoid located.')
		else
			print('Couldn\'t find humanoid.')
		end
	else
		print('Target is nil.')
	end
	wait(1)
end

1 Like

I’ll try that. Give me a few minutes

1 Like

Sounds good, let me know! I also provided a video above of what the code does to the edit above.

1 Like

image
Works pretty well. I’m going to try to script with it a bit, I’ll provide results afterwards. Thank you!

1 Like

Bruh


Same error.

This is so infuriating.

1 Like

I’ve seemed to fix it with some hacksaw magic. Thank you for helping me out.

1 Like

Apologies, I hadn’t seen your previous post. No worries though!