Checking if Billboards Adornee is the Last Adornee

Alright I’ve been struggling with this one for a while, I’m maki by an interaction system
(like bloxburg / Roville / Sims )

I have a billboard Gui and every frame it
checks if you are close to an interactable object.

Local Obj = nil

If you are close to (example: A Chair) then it will say “E to Sit” and (Obj = The chair) now

the billboard adorned is the Chair (Obj) and say you move really quickly

to a (example: Bed) now you want it to say “E to Sleep” now in that one frame I need to check if the billboards adornee is still the chair

or is it the bed so I can put “E to Sit” or “E to sleep”

Confused?
I know

Hi,
this is a youtube vid covering what you need. His script shows how to do it, and I’ve tested around with it in my games, and it seems to work. Follow it, and adjust the code to work for you

best of luck

edit: it uses a normal gui, but you can switch the code around to change it to a billboard gui

1 Like

Using GetPropertyChangedSignal doesn’t work because like I said it’s checking every frame if your near a different object so the adornee is always changing to it’s self

What. I’ve. Tried…

Local Old

When you are near an obj old becomes that obj and if you change the adornee if old doesn’t equal Obj then

Change()

But still doesn’t work… lol

just use the new feature Proximity Prompt: Roblox Tutorial - Press Key to Interact (Proximity Prompt) - YouTube

1 Like

I watch that video, but mine is different because I want to change multiple text buttons

Example of my layout (sims style)

          Eat

Sleep. Shower
oof

See what I mean?

Also I’m not using collection service

I don’t want the proximity prompt lol but thanks for replying

Please provide your code, this way we get a better understanding of what you’ve tried and how you’re currently doing it :upside_down_face:

1 Like

Umm I’m not my pc, but I’ll try to explain

Why not use just the one text button, and change what it says. Simply check what the adornee is, and change it to correspond, simple example

if Adornee == chair then
    BillBoardGui.Text = "E To Sit in Chair"
    --Run code here to do the right animation/ what you want
end
1 Like

Alright

Local Billboard
Local RunService
Local Char

Local Obj
Local Old

RunService.RenderedStepped:Connect(function()
For I,v in pairs(Table) do
Local distance = Char:GetDistanceFromCharacter(v.Position)

If distance >= 7 then
Obj = v
Billboard.Adornee = Obj

If Old ~= Obj then
Change()
end

Old = Obj
end

End)

Having an entire if else statement in a runservice loop isn’t what I’m looking forward to (lag and messy)

Also to many parts you can interact with

I haven’t reveiwed the code in a video for a while, however, couldn’t you just have a function outside of it, that you can call inside the loop? The function would check what the value is, and return an answer/do whatever you need to do

1 Like

Tried that too, it also doesn’t work :no_mouth:

It’s the same as having it in the loop

Haha, it is, misread your post

Honestly, your code looks fine to me. There are a few syntax error, though.

GetDistanceFromCharacter requires the player object, not the character. RenderedStepped should be RenderStepped. locals shouldn’t be capitalised. Other then that, the code makes logical sense, to me atleast. May I ask what Change() is?

1 Like

Thanks anyways lol but I managed to fix it

Local LastObj = nil
Local Obj = nil

Obj = [closest Object]
If Obj ~= LastObj then
Change()
end

LastObj = Obj