Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

why cant A players Mouse Get Humanoid when click?

Asked by 4 years ago
Edited 4 years ago

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

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. LudeonDev 50 — 4y
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 HKprogram 48 — 4y
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! LudeonDev 50 — 4y
0
Try Target.Parent:FindFirstChild("Humanoid") not Target:FindFirstChild("Humanoid"). That is probably the problem. Zeuxulaz 148 — 4y
0
@LudeonDev I watch Both of them and are in Devkings Discord server lol HKprogram 48 — 4y

1 answer

Log in to vote
0
Answered by
Zeuxulaz 148
4 years ago

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

Ad

Answer this question