Yes, but first you can’t have a LocalScript inside a part in workspace. They won’t run in workspace. Second, you have to check to make sure the part touching the “script.Parent” object is the player. Also, don’t use the TouchEnded event because it’s not reliable for this purpose. Use a radius and looped distance check instead, or create a hitbox part so the events will not fire due to the player idle animation.
Just add a debounce between the the beginning and the ending of each scopes. If that doesn’t solve the problem, just show us the error if it throws you an error.