--//Configs

local REAPPEAR_TIME = 2 --//Once the part becomes invisible, after this amount of seconds it'll appear again
local FADE_TIME = 1 --//How long it takes for the part to become fully visible/invisible

local function Animate()
	if isAnimating then return end

	isAnimating = true

	local targetProperties = {}
	targetProperties.Transparency = 1

	local disappearFade = tweenService:Create(script.Parent, TweenInfo.new(FADE_TIME), targetProperties)

	disappearFade:Play()
	disappearFade.Completed:Wait()

	wait(REAPPEAR_TIME)

	targetProperties.Transparency = 0

	local appearFade = tweenService:Create(script.Parent, TweenInfo.new(FADE_TIME), targetProperties)

	appearFade:Play()
	appearFade.Completed:Wait()

	isAnimating = false
end

script.Parent.Touched:Connect(Animate)
