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

Trying to make a script that checks if the part is touching terrain, Is this even close?

This is a function that's part of a bigger script but the function is supposed (when called) to check if specific parts of a model are touching the terrain. I'm starting with just one part though to test the concept. Here is what I have so far, and the variables probably won't make sense without seeing the rest of the script but i'm trying to keep it simple. So to simplify I want to check if Floor is touching Terrain. Am I close?

function check_grounded()
	local player, char = get_pc()
	local Floor = char.EXAMPLE.Floor
	local Terrain = workspace.Terrain

		Floor.Touched:connect(function(Terrain)
  print(Terrain)
end)
		end

2 comments

0

The Touched event isn't gonna work with terrain, unfortunately.

0

Touched event works fine with terrain

1 answer

Should work just fine except that you should change

print(Terrain)

to

print(Terrain.Name)

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