I can’t reproduce this issue with your code. Is there more than one car? i.e. when you hit H does “Working” print just once per keypress? The input bind happens as soon as the script executes, so every car with this script should be responding to pressing H, until you’ve gotten in and out of each one at least once.
Its probably not changing because the GUI is spawned into the player after they get into the seat and deleted while they get out.
thats an extremely important detail lol. However binds get automatically cleared when a script is destroyed. So if your script is inside your gui and it gets destroyed when the player leaves then try not trying to disconnect it. If your script is not getting destroyed then throw it in the gui
It still will not disconnect for me, unfortunately. Im losing my mind trying to figure out what is not working.
This only applies to certain connections. Some connections are not cleared automatically.
I just tried adding a disconnect for when the script is being destroyed too and it still will not disconnect.
InputBegan connections are though
This is what I don’t understand, is that it is showing that it is removing but when I check to see if they disconnected, it still shows that they are there.
This is normal; there will still be a “connection” stored but it’s inactive. What really matters is whether or not the connections still work.
Yes, the connections still work. If I get back in the driveseat it will start running those functions another additional time for each time I get back into the driveseat.
So if I get into the drive seat 3x it will run the InputBegan function 3 times even though there is one script in existence.
(Keep in mind there is a main server script that clones the GUI and deletes the GUI each time the player gets in or out of the seat.)
Could you add something like print(script.Parent)
to one of the connections to confirm the scripts are actually gone? I’m unable to reproduce this problem. All my connections are disconnecting even when the script is cloned from the server.
Printing the connections doesn’t confirm they’re inactive. Press H or whatever causes the connections to print a message.
Okay, once I get out of the driver’s seat it stops working but when I get back in it starts running duplicates.
If I get out/in X amount of times, it runs the function X amount of times.
Do you know why it would be causing this?
I have decided to make it print the parent every time the input is pressed.
This is what it shows the 2nd time I’ve gotten in the driver seat:
This is what it shows the 3rd time I’ve gotten into the driver seat:
This is what it shows the 4th time I’ve gotten into the driver seat:
Hopefully, you can see the pattern.
it should technically be printing the parent the same amount of times it prints “T” but it is not. So I guess the old scripts don’t have a parent but are still running the function if I’m in the driver’s seat?
I Still need help with this, I am still having issues.
try printing A.Connected and B.Connected
just making sure that the issue actually originates with them not disconnecting and not somewhere else
Okay so I did that, and it will only print "(true,true) " once which I guess is the active script. But the function is still firing X amount of times that the player sits in the seat.
Welp, I have figured out the solution, the script responsible for deleting the GUI ended up being a local script. This would explain why nothing is showing on the client’s end. I am foolish for not checking the server to see if the GUI was even being deleted, to begin with. Let this be a lesson not to trust other people’s scripts as they may have done something stupid. My apologies for the time wasted that yall put in, I thank everyone here for their help.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.