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

why cant A players Mouse Get Humanoid when click?

So I am Working On A gun And right Now I Need it to Find Humanoid Player When Clicking On It.

heres my script:

local mouse = game.Players.LocalPlayer:GetMouse() -- mouse
local Handle = script.Parent.Handle
local Gun = script.Parent
local ShootSound = script.Parent.Handle.Shoot

Gun.Activated:Connect(function() -- Activates the gun (Mouse Clicked While Equip)
	mouse.Hit:Connect(function(Target)
		if Target:FindFirstChild("Humanoid") then 
			game.Players.LocalPlayer.Character.Humanoid:TakeDamage(10)
			ShootSound:Play()	-- This is a Gun Shoot Sound 
		else
			ShootSound:Play()
			print("Target Not Humanoid")
		end
	end)
end)

The Thing is that At It dont show what line it is and It Gives a error that says (Connect is Not A vaild member of CFrame ) And I never Took CFrame on the Line.

Anyone? Help

5 comments

0

I would look at Object Browser. On line 07 .Hit is a property and not an event. That is why you are getting CFrame Errors because Hit deals with CFrames. Please look at object browser. Did you mean Button1Down? Happy scripting.

0

@LudeonDev thanks for the Help attempt. Ill Try to Fix this. I am Kind Of Bad Knowledge By MousePoint scriptting and stuff but yeah ill try

0

Hey dude, it is fine everybody stuggles just as long as you don't give up things will work out. I would really reccomend learning from AlvinBlox and TheDevKing, very good youtubers. Well, yea you are using a property and not an event. Happy scripting. All the best!

0

Try Target.Parent:FindFirstChild("Humanoid") not Target:FindFirstChild("Humanoid"). That is probably the problem.

0

@LudeonDev I watch Both of them and are in Devkings Discord server lol

1 answer

✓ Accepted answer

Try Target.Parent:FindFirstChild("Humanoid") not Target:FindFirstChild("Humanoid"). That is probably the problem.

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