So i'm trying to make a part that when you click on it you just flat out die. I tried asking the discord but they're like busy answering other peoples questions but even when I ask mine when all the questions are over they don't read it or just ignore it? I would consider they didn't see but idk maybe nobody on there really likes me maybe.
So I search on Google how to make a "part that kills you when you click it" and "How to get humanoid from MouseClick"
I go on the websites and type the examples in my own way but it doesn't show errors and it just doesn't work and I assume they might be outdated or something, here's what I typed:
local player = game.Players.LocalPlayer local character = player.Character local Part = game.Workspace.DeathPart Part.ClickDetector.MouseClick:Connect(function(playerWhoClicked) playerWhoClicked.Character.Humanoid.Health = 0 end)
If it does not work you probably:
To make it work do this:
Insert a part into your workspace. Then insert a click detector into that part. Now insert a script inside the click detector and type this:
script.Parent.MouseClick:Connect(function(PlayerWhoClicked) PlayerWhoClicked.Character.Humanoid.Health = 0 end)
(EDIT)
I tried running the script in my world, and the problem is because you included
local player = game.Players.LocalPlayer
from that error, the whole script stopped to function. You can't call anything that is outside that one particular part, that'll break the script, which what happened to yours.