I'm confused on how TouchEnded works

I have a giant block that covers an island that fires these two functions:

However, whenever you jump or change on the Y axis, it fires the touchend function.

2 Likes

Does the big block stretch up onto the “Y” axis?

2 Likes

i woudnt think so,that would be so see able

Not if transperancy = 1 and cancolide = false.

1 Like

Yea, it stretches high up, the block is like a giant cube size 800 on each axis. It’s giant. But if you jump it ends the touch event.

What is eaxctly your problem? Is the TouchEnded firing when it’s not supposed to

Pretty much, it’s a giant block that surrounds my island, and whenever I jump or get shifted on the Y axis, it fires the touchended function, even if I’m smack center in the middle of the block.

I don’t think TouchEnded is built for interior collisions. You should be using Region3 instead.

1 Like

Touched events are very unreliable. Sometimes they don’t fire on touches, most of the time they fire a ton of times while you are making a touch. You can use Region3 or magnitude depending on what you are trying to accomplish, these are much more reliable but require loops instead of being event based.

6 Likes

Yea, I decided to use magnitude to find the magnitude between islands and if you’re out at sea, etc. It feels bad because TouchEnded and Touched would be such an amazing way to do this without having to check and add more stress on the server.

2 Likes

you could just have boundaries on the edges of islands and when those are touched adjust accordingly

the Touched event in this case would be much more accurate and could only fire if you actually touch it, where as TouchEnded fires even if you’re still touching it

That makes it harder to determine whether they’re entering or leaving the island.

not really, could have 1 set of boundaries on the water which means theyve left the island and are on the water, and the other one on the land which means theyve left water and entered land.

or they could just use the boundaries to start checking for magnitudes for a certain period of time instead of constantly checking magnitude

I agree with Muoshuu, if I have a rowing animation for boats, then if my arm goes back and touches the boundary on the way out, it’ll register as me entering even though I’m clearly leaving. Magnitude is the best option.

To counter that server stress, I check magnitude at intervals of 1 and a half seconds so it doesn’t lag that that hard.

I use a combination of both touched and magnitude check, while ignoring Touched-ended altogether. Once first touched has been initiated I set a lock (permanent debounce) and I spawn a coroutine that checks periodically the magnitude. Once player moves away I reset the lock and end the coroutine. Works like a charm.

2 Likes