Radius-based contextual seat UI

I’m not sure what the best way to go about making an interactive UI for seating a character would go. I’ve thought of comparing distances of Seats, and what I’ve tried recently is checking touched objects with a sphere around the player (video below).

Would the method I’ve shown above be the best way to go about this? If not, what are some other ideas? I’m not sure if checking touched objects would be performant at all.

Thanks in advance!

1 Like

You could use Region3 or something similar to get all the parts around the player, then loop through them and put the context action button on the closest object that can be interacted with.

There might be a better way but that should work.

I think this is a reliable method. I’ve never thought of that, but I may end up using it now.

btw nice username

That sounds even less performant than a sphere with a Touched event listener… I’m not sure about that.

In theory it’d be interacting with the same amount of parts, and you could control the interval at which it checks parts.

Like I said, I’m not sure if there’s a better way and you’d probably need to do some testing to find out which is most performant.

Alright, sounds good. Mainly asked because there’s a ton of cool new stuff being added to Roblox and I wasn’t sure if there was something new that could do this (and well).

1 Like

Looping through all intractable object will be a lot more performative. Touched events will break down with lots of lag as soon as players start moving around a lot more complex maps. If you start having so many objects that it starts effecting performance you can look into spacial partitioning.

Since you are looking into using different/useful things inside of Roblox, I suggest looking into how you could use CollectionsService to tag seats and make your code a lot simpler.


…Are you absolutely sure using a simple Touched event with a short if statement would be less performant than looping every interact-ableobject? I’m unable to test at the moment.


Complex collision maths on Roblox’s end on meshs, unions, and parts of all sorts vs. simple distance calculation.

Isn’t there a ProximityPrompt made for this?