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

How to check if a player touch lava ?

Asked by 6 years ago

Let's say i want to print (player.Name.." died") with the player touch the lave (Terrrain)

but i don't know how to detect when a player touch lava.

(sorry for my bad english)

2 answers

Log in to vote
1
Answered by 6 years ago

Roblox humanoids actually have a property for this called "Floor Material" http://wiki.roblox.com/index.php?title=API:Class/Humanoid/FloorMaterial you can read up on it there!

Heres some basic code.

while wait(0.1) do
    if plr.Character.Humanoid.Health ~= 0 then -- Check if they are not dead!
        if plr.Character.FloorMaterial == Enum.Materials.CrackedLava then -- Tell if they are touching lava
            plr.Character:BreakJoints() -- Kill them.
        end
    end
end
Ad
Log in to vote
0
Answered by 6 years ago

My assumption is that the lava terrain is made out of a different material, so incorperating "Color3 GetMaterialColor ( Material material ) Returns current terrain material color for specified terrain material." would probably be the best way.

Not certified

Answer this question