Hello, during development of my game I have encountered a problem, I can't seem to detect when one player clicks on another player with a tool.

Ive tried using Mouse.Button1Down paired with Mouse.Target to see if that will work but I got no results.

Heres my current code:

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()

local function click()
local Targ = Mouse.Target
if Targ.Parent:FindFirstChild("Humanoid") then
-- code
end
end

Mouse.Button1Down:Connect(click()

Anybody got any ideas?

3 comments

2

Seems like you have a error in your last line - :Connect(Click() Should be - :Connect(Click) i think. If it still has the issue let me know and i'll see what i can do

0

^^^ the guy above told you the answer.

0

^^^ the guy above is correct