Hello there, I was making an Obby and I was at the lava jumps part but I don't know how to make the script of lava jumps so can u show me the script and explain how the script works so I can do it by myself.
How to make blocks like lava kill humanoids?
2 answers
This is pretty easy. All you have to do is make a script in the part you want to kill the player. Then insert this
script.Parent.Touched:Connect(function(hit)
local character = hit.Parent
local human = character:FindFirstChild("Humanoid")
local player = game.Players:GetPlayerFromCharacter(character)
if player and human.Health > 0 then
human.Health = 0
end
end)
So what this script does is. First we connected the part with .Touched event.
The .Touched event will return us the part that touched the lava part.
Once we have what touched the lava part we need to check if the part is the player, so we get the character by getting the Parent of the part, then we use character:FindFirstChild("Humanoid") to get the Humanoid that contains the Health of the character and we get game.Players:GetPlayerFromCharacter(character) to get the player from the character.
Now that we have all we need we do an if statement to check if its a player and its not dead then kill the player by changing its health to 0.
- local boostPart = script.Parent
- -- Set a variable for boosted jump power
- local BOOSTED_JUMP_POWER = 250
- local function onPartTouch(otherPart)
- local partParent = otherPart.Parent
- local humanoid = partParent:FindFirstChildWhichIsA("Humanoid")
- if humanoid then
boostPart.CanCollide = falselocal currentJumpPower = humanoid.JumpPowerif currentJumpPower < BOOSTED_JUMP_POWER thenhumanoid.JumpPower = BOOSTED_JUMP_POWERboostPart:Destroy()
13 wait(10) 14. humanoid.JumpPower = currentJumpPower 15. end 16. end 17. end
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
yes look on answers