Any alternatives to touchended? [Solved] [closed]
I've recently been making a custom tool pick up script, however, I've noticed that touch ended can be very buggy in which it can activate even when the player is still inside the part. The player is supposed to pick up the object when pressing "e" however if the player were to walk across the part, if the script does not have touchended, the player would still be able to pick up the object after walking pass it with the press of "e". Thus, I needed a touchended to create a variable to stop this from happening. Though it does solve the previous problem, it created a new one in which touchended would fire even when the player is still touching the object, continuously activating my touch ended variable and breaking my script. Can anyone help with this?
03 | Prompt.onClientEvent:connect( function (player) |
07 | game:GetService( "UserInputService" ).InputBegan:connect( function (inputObject, gameProcessedEvent) |
09 | if inputObject.KeyCode = = Enum.KeyCode.E then |
10 | if not Equipped and HasTouched then |
23 | Prompt 2. onClientEvent:connect( function () |
25 | print ( "Touched Ended" ) |