I don't know if it's possible to check what terrain type is touched, but if so, would this be to check?
script.Parent.RightLeg.Touched:connect(function(hit)
if hit.Material == Enum.Material.Slate then
-- stuff
end
end)
I don't know if it's possible to check what terrain type is touched, but if so, would this be to check?
script.Parent.RightLeg.Touched:connect(function(hit)
if hit.Material == Enum.Material.Slate then
-- stuff
end
end)
GetCell()
CellMaterial, CellBlock, CellOrientation GetCell ( int x, int y, int z ) Returns the material, type, and orientation of grid cell (x, y, z).
^From the wiki
You could call that method when your character is touching the Terrain, and getting the Cell doing Character.Torso.Position.Y-4 or something.
GetCell() will return the Material of the Cell.
Et voila. Nice one :)
If you're not aiming for game terrain, then this should do:
script.Parent.RightLeg.Touched:connect(function(hit)
print(script.Parent.Name .." has touched ".. hit.Material) --Easy fix, just be sure to have the Output window open in studio. (Found in the View tab.)
end)
Hope that helps!
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
I think you can't work with terrain like that. It's kind of a whole in workspace, you gotta put your own bricks to script with
I think that's what he's aiming for, kindof like brick-material, and not game Terrain... If so, then just print in the output print("Player has touched on Slate") and so on...