How to make a Boolean variable

Hey, just wondering how I can make a boolean variable on wether a player is touching a part or not… heres where i would like to put it, so that IF a player is touching part = true, then part colour changes to ‘teal’. Thanks for any help!

Define a variable named isTouched and set it to false.
You want to use the part’s .Touched and .TouchEnded events.
Then change isTouched to true in the .Touched event, and isTouched to false in the .TouchEnded event.

1 Like

Thanks for the response, I find the touchended event causes the part to switch between the new color and old color and is really buggy in general, is their a way to fix it?

1 Like

I can’t remember one, maybe a quick look yourself will work.
Just the nature of roblox collisions ¯\_(ツ)_/¯

Found a reply to a post containing quite a few solutions