How do you detect contact with Terrain?
I have a large game that features the Smooth Terrain feature. However, what I would like to do is light a player on fire when they touch Cracked Lava terrain, as described in the following pseudocode:
2 | for plr in game.Players do |
3 | if plr is touching CrackedLava terrain |
Basically, that is what I need to do. However, it probably will not need the loop, as that could cause lag. Here is another method I came up with that probably won't work, but I can't try it, as I don't actually know how to do some things.
1 | let terrain = game.Terrain |
3 | for (voxel of type "CrackedLava" ) in terrain do |
4 | (surround terrain with part named "LavaPart" ) |
7 | for (part named "LavaPart" ) |
8 | (insert script from ServerScriptService into part) |
That might work, but still would have lag on older machines, most likely even more than the initial method of covering it in bricks. It would also need to have a way to gather all the Smooth Terrain voxels. However, it does solve two initial problems, and an answer like this would be acceptable. (I really just want to not spend a really long time covering up my world with parts.)
So, can anyone please rewrite one of these examples into actual ROBLOX Lua or come up with a completely different method that works? (Please explain any code, as I am trying to learn some stuff by making ROBLOX games)