Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-2

I cannot make a block kill, I need the basic command please? [closed]

Asked by 7 years ago

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?

0
i am not joking, i suck at scripting Overlord_Doge -14 — 7y
0
Also, please do some research next time; this isn't a request site. Our purpose is to help those w/ their scripting problems, and not to give out scripts. If you wish to learn to script, look up tutorials, or reverse engineer. TheeDeathCaster 2368 — 7y
0
In other words, at least make an attempt. ;/ I recommend learning to script first before this though, otherwise that wont turn out well. TheeDeathCaster 2368 — 7y

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?

2 answers

Log in to vote
0
Answered by
Zeluxis 100
7 years ago
Edited 7 years ago

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

0
thank you Overlord_Doge -14 — 7y
0
Explain it please? M39a9am3R 3210 — 7y
Ad
Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

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