The problem that I noticed is that when you firstly bind something with tween it starts the tween for no reason when it’s binded.
I started making a game which has interactive parts which can be accessed as a GUI appears that says “f to interact” when you get closer to it and vanishes when you go farther then the minimum number. So, when the UI appears the F key will get bind with the appropriate door and calls a function EnterDoor.
It finds the door’s hinge and tweens it and plays it at the same time. My theory was that if I bind this then when only I press “f” it will activate but here comes the unwanted truth. When the bind action happens it automatically starts the function for no reason once and I don’t want this to happen.
I know how can I fix it inside the function but I want to know is there any way this can be fixed without making my function longer?
In the :BindAction function, the parameters should be this: “(actionName, functionToBind, createTouchButton(true or false), and inputTypes (in your case it would be Enum.KeyCode.F)”.
If everything is correct there I would check over the functionToBind. Parameters for that should be (actionName, inputState, inputObject).
Also are you binding the EnterDoor() directly or is it inside of another function?
Okay, now I seem to understand what’s happening. So the “EnterDoor” Function had a bool value so if it’s true then do the door open tween and when its false do the close tween but when You press “f” key it sends 2 signal. One is pressed and another one is lifted. So that’s why when I try to press f is suddenly makes the door play both animation after another so It looks like the door is having a seizure.