I know, i am a very beginner and i tried searching it up on You Tube, so can someone just give my the basic script to copy and paste please?
Although this isn't a request site, I can give you the script.
function onTouch(part) local humanoid = part.Parent:FindFirstChild("Humanoid") if (humanoid ~= nil) then humanoid.Health = 0 end end script.Parent.Touched:connect(onTouch) -- put this into a script inside a part
Please accept this as your answer if it helped.
[EDIT]
An administrator wished for me to explain the script.
"local humanoid = part.Parent:FindFirstChild("Humanoid") " - Finds the humanoid and labels it as humanoid inside the script
"if (humanoid ~= nil) then" - Checks if it's actually a humanoid
"humanoid.Health = 0" Sets the health of the humanoid to 0, 'killing' it
It creates a function called onTouch() it passes the part that is touched into the function, it then creates a local variable for humanoid setting it to find the humanoid that touches it, if the humanoid is not empty then set the humanoid's health equal to 0, then it ends the if and ends the function, lastly script.Parent.Touched:Connect(onTouch) means that it calls the onTouch function when the Parent of this script is Touched.
This answer was posted by Acreos, I am explaining it for M39a9am3r.
function onTouch(part) local humanoid = part.Parent:FindFirstChild("Humanoid") if (humanoid ~= nil) then humanoid.Health = 0 end end script.Parent.Touched:connect(onTouch) -- put this into a script inside a part
Closed as Not Constructive by TheeDeathCaster and BlueTaslem
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?