Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Roblox Script to trigger/detect when players walk on CrackedLava terrain and kill them
- -- Create this as a new Script on your Terrain object.
- function onTheLava(character)
- local checkRay = Ray.new(character.HumanoidRootPart.Position, Vector3.new(0, -50, 0))
- local gridPart, intersect, surface, material = game.Workspace:FindPartOnRay(checkRay,nil,true,true)
- if (material.Name == "CrackedLava") then
- return true
- end
- return false
- end
- function onTouched(hit)
- if hit.Parent then
- if hit.Parent:FindFirstChild("Humanoid") then
- local vPlayer = game.Players:playerFromCharacter(hit.Parent:FindFirstChild("Humanoid").Parent)
- if (vPlayer ~= nil) then
- local char = hit.Parent:FindFirstChild("Humanoid").Parent
- if onTheLava(char) then
- hit.Parent.Humanoid.Health = 0
- end
- end
- end
- end
- end
- script.Parent.Touched:connect(onTouched)
Add Comment
Please, Sign In to add comment