of     2   
chevron_rightchevron_rightchevron_right

gohan31865
#224357911Monday, August 28, 2017 7:03 PM GMT

it hurts my brain to think of a way to do this. im not asking for a script, i just need ideas as to how to approach this. player is nearby an object(region3 or .magnitude, and do i have to use a loop for it?), billboard gui appears on top of said object (client only, no FE, i plan to use a billboard gui in startergui and set its adornee), and when the player is actually nearby, hit E to do stuff to the object (user input service) the problem is that i cant find a better way to check for the object other than using an infinite loop, or as said in another thread, runservice (both on client). and if i wanted to be able to interact with multiple objects (NOT all at once), how can i find a good way to identify such object? any ideas?
gohan31865
#224359778Monday, August 28, 2017 7:47 PM GMT

bup
KeysOfFate
#224360546Monday, August 28, 2017 8:07 PM GMT

I did the exact same thing lol. I tried to make an NPC with dialog using a magnitude detector and a sketchy button system.
xformula
#224360561Monday, August 28, 2017 8:07 PM GMT

Maybe u should not even use the magnitude or region3 approach. instead use something like Mouse.Target and if they are hovering their mouse over a part which u want to interact with will display a gui with an e and if they press e then they can interact with it
gohan31865
#224361269Monday, August 28, 2017 8:26 PM GMT

it sounds like a viable idea until u realize that it'd be less efficient to hover over the object and hit e rather than just clicking on it i'm not trashing your idea but still, there has to be a better way of doing this than that and the initial approach
xformula
#224361476Monday, August 28, 2017 8:31 PM GMT

i think the most efficient method would be doing it with runservice. are u trying to find a more efficient method because of lag?
xformula
#224361621Monday, August 28, 2017 8:35 PM GMT

wait instead of using magnitude or region3 u can set the MaxDistance of the billboard gui
gohan31865
#224361660Monday, August 28, 2017 8:36 PM GMT

yes i am actually, since ive heard stories of unbearable lag due to while true do loops and such. also with runservice, i get the idea but how would i check for objects in workspace? workspace.brick --if i do this then i'd have to do it for every single thing i want to interact with
gohan31865
#224361722Monday, August 28, 2017 8:37 PM GMT

as for max distance, i would do that if it werent for the fact that i cant locate objects to set the adornee of the billboard gui to. again, directly referencing a specific object would lead to painstaking amounts of typing
xformula
#224361901Monday, August 28, 2017 8:42 PM GMT

just use a infinite while loop and just use waits between calulations that will reduce your lag
Fangous
#224361937Monday, August 28, 2017 8:42 PM GMT

I'm doing something like this right now actually Currently I'm using a RenderStepped loop checking for magnitude. Since it's the only loop on the client, it's not laggy at all. Then I use worldtoscreenpoint for the GUI. Looks better than billboard guis (imo).
xformula
#224361988Monday, August 28, 2017 8:44 PM GMT

probably the best option of detecting would be a region 3 since u dont have to use as many calculations
gohan31865
#224362016Monday, August 28, 2017 8:44 PM GMT

the question still stands how would i locate the objects?
gohan31865
#224362131Monday, August 28, 2017 8:47 PM GMT

if i use region3, would i just have to draw it around the player? also doesn't region3 just stay in the same place, not constantly being updated?
xformula
#224362378Monday, August 28, 2017 8:52 PM GMT

yeah it stays in the same place. u can use renderstepped to update it and have it around your character you can use workspace's FindPartsInRegion3WithIgnoreList to get parts that are in your region3
xformula
#224362451Monday, August 28, 2017 8:54 PM GMT

idk if it would be effient tbh since u would be looping a loop at that point just use the other guys idea of using a magnitude with renderstepped
gohan31865
#224364560Monday, August 28, 2017 9:46 PM GMT

nwe problem; i cant set the region3's cframe or size. anyone know any tricks to getting around this?
gohan31865
#224365905Monday, August 28, 2017 10:16 PM GMT

bup
gohan31865
#224367291Monday, August 28, 2017 10:51 PM GMT

b u p
gohan31865
#224374992Tuesday, August 29, 2017 1:53 AM GMT

so after learning that i cant move region3's, i switched to magnitude and so far ive gotten good results. the only problem now is that i cant seem to find a solid way to identify the object (given that its inside of a model, which is inside of a folder). what if i want to identify the object but there are multiple copies of it?
gohan31865
#224376714Tuesday, August 29, 2017 2:41 AM GMT

le b u m p
gohan31865
#224378398Tuesday, August 29, 2017 3:30 AM GMT

boop
PhantomVisual
#224379361Tuesday, August 29, 2017 4:02 AM GMT

How I would do it is I'd check if the object is near the player (use magnitude). If they are close, check the magnitude between the object and the Mouse.Hit.p. If the mouse is close to it, show the billboard. Just use an infinite loop, they ain't that bad. As long as you don't over use it, you'll be fine.
gohan31865
#224389111Tuesday, August 29, 2017 1:40 PM GMT

isn't .magnitude for 3d objects and mouse.hit.p for 2d objects?
PhantomVisual
#224415761Wednesday, August 30, 2017 2:41 AM GMT

magnitude is used to find the distance (in studs) between two vectors. ex: (Vector3.new(0,0,0) - Vector3.new(0,5,0)).Magnitude --would equal 5 Mouse.Hit.p is a vector3 value (its 3d basically) and it returns the position the mouse is in based off of worlds space.

    of     2   
chevron_rightchevron_rightchevron_right