Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

how do i make something kill humanoids?

i want to make a obby so i was making the lava jumps part but i dont know how to make the lava kill humanoids. like if a humanoid touches the block then the lava will break the humanoids joints. note:this is my first time asking so u might not understand my question.

1 answer

Hello there.

The easiest way of doing it would be the following.

Put the script inside the parts.

There are more ways, but this is the easiest one.

--Variables--
local Brick = script.Parent
--End--

--Code--
local function PlayerTouched(Part) --The function to be fired
	local Parent = Part.Parent --Finding the Player
	if game.Players:GetPlayerFromCharacter(Parent) then --Checking if the part is actually a player in the server.
		Parent.Humanoid.Health = 0 -- Setting the health of the player to 0, which kills them.
	end
end

Brick.Touched:connect(PlayerTouched) --This fires the function when a player touches the part

7 comments

0

maybe you should explain it?? lol its right but explain it to the guy so he can benefit from it.

0

As he said, it was his first time asking, I wouldn't want to over confuse him with all the explaining, would've he asked for extra explanation, I would've of course explained it.

0

explanation is needed for a perfect answer. If you scared that he won't understand it, try to make it as simple as possible

0

Yeah well, truth to be told, I didn't even think about the explanation, it didn't cross my mind at all, so yeah.. I normally do include explanations though.

0

thanks Torren_Mr

1

i did it and it worked for me but i was reading the comments and they were talking about explanation i should have asked u about explanation that time but im gonna go serch it up rn

0

There, I added some explanations too, don't forget to accept my answer so other people can already know this has been answered :)

This discussion is preserved as it was. New answers, comments, and votes are closed.