So ive been trying to make a part kill you using clickdetector by myself first, but all my attempts were unusuccesful
local players = game:GetService("Players") local ClickDetector = game.Workspace.clickpart.ClickDetector local clickpart = script.Parent clickpart.ClickDetector.MouseClick:Connect(function(hit) local player = players:GetPlayerFromCharacter(hit.Parent) if player then local humanoid = hit.Parent:FindFirstChildWhichIsA("Humanoid") if humanoid.Health > 0 then humanoid.Health = 0 end end end)
Your mistake is in line 6. 'Hit' is actually Player, so you don't need line 6.
This should work:
script.Parent.ClickDetector.MouseClick:Connect(function(plr) plr.Character:FindFirstChild("Humanoid").Health = 0 end)