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

Detect when the client player clicks on another player?

Asked by
dashct 0
3 years ago

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?

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 I_Nev 200 — 3y
0
^^^ the guy above told you the answer. Mroczusek 111 — 3y
0
^^^ the guy above is correct User#30567 0 — 3y

Answer this question