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)
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.
1 | while wait( 0.1 ) do |
2 | if plr.Character.Humanoid.Health ~ = 0 then -- Check if they are not dead! |
3 | if plr.Character.FloorMaterial = = Enum.Materials.CrackedLava then -- Tell if they are touching lava |
4 | plr.Character:BreakJoints() -- Kill them. |
5 | end |
6 | end |
7 | end |
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