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

How to check if a player touch lava ?

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

✓ Accepted answer

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

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

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