Ad
Log in to vote
0

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

Asked by 5 months ago

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

0
The Touched event isn't gonna work with terrain, unfortunately. Perci1 4768 — 5mo
0
Touched event works fine with terrain GixxerK3 15 — 5mo

Hi.

Looks like you're using an ad blocker.

That's fine...

No, it really is.

Just, I mean, we put a lot of work into this site, you know?

It would be really really appreciated if you would turn off your ad blocker for our website...

We tried really hard to make our ads as unobtrusive as possible.

If you really hate ads, would you consider a $2 donation via Patreon?

Here's the link.

We love you. We hope you love us too.

.

..

...

Now back to your regularly scheduled Scripting Helpers....

...

..

.

1 answer

Log in to vote
0
Answered by 5 months ago
Edited 5 months ago

Should work just fine except that you should change

print(Terrain)

to

print(Terrain.Name)
Ad

Answer this question



Ad