script.Parent.MouseButton1Click:Connect(function(hit)
local h = hit.Parent.Parent.Parent.Workspace:FindFirstChild("Humanoid")
if h then
print("Congrats!")
end
COMMUNITY QUESTION
Script wont print "congrats" when the player clicks a gui and detects a humanoid?
1 answer
hit is not a valid argument of MouseButton1Click.
That means hit is nil because the event MouseButton1Click does not return any arguments.
To fix it get rid of hit and do this on line 3:
local h = game.Workspace:FindFirstChild("Humanoid")
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
How would I fix it?