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

Where did i go wrong? Output tells me nothing..

function onClick(player)
    local check = player.Parent:FindFirstChild("Humanoid")
    if check ~= nil then
        local user = game.Players:GetPlayerFromCharacter(player.Parent)
        print(player.Name.." was found!")
       end
end

script.Parent.ClickDetector.MouseClick:connect(onClick)

1 answer

✓ Accepted answer
function onClick(player)
    if player.Character:FindFirstChild("Humanoid") then -- we don't need to use that variable for the check.
        print(player.Name.." was found!")
       end
end

script.Parent.ClickDetector.MouseClick:connect(onClick)

When using onclicked, the part that clicked it doesn't return. what returns is the player that clicks it.

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