Using TweenService to play a button animation freezes the script?

I’m trying to play a tween animation for when the button is clicked. However when I click the button the first time, everything works but the second time nothing happens and the button stays red. No errors or anything. Any idea what’s going on?

local tweenService = game:GetService("TweenService")
local tweenInfo =
local goal1 = {Size =, 1, 0.05)}
local goal2 = {Size =, 1, 0.25)}
local Enabled = script.Parent.Parent.Enabled.Value
local Lasers = script.Parent.Parent.Lasers
local Button = script.Parent
local tween1 = tweenService:Create(Button, tweenInfo, goal1)
local tween2 = tweenService:Create(Button, tweenInfo, goal2)

debounce = false
function wat(player)
	if player.TeamColor == script.Parent.Parent.Parent.Parent.TeamColor.Value then
		if Enabled and not debounce then
			debounce = true
			Enabled = false
			Button.BrickColor ="Really red")
			Lasers.BrickColor ="Bright green")
			Lasers.Transparency = 0.8
			Lasers.A.Enabled = false
			Lasers.B.Enabled = false
			Lasers.C.Enabled = false
			debounce = false
	elseif not Enabled and not debounce then
		debounce = true
		Enabled = true
		Button.BrickColor ="Bright green")
		Lasers.BrickColor ="Really red")
		Lasers.Transparency = 0.5
		Lasers.A.Enabled = true
		Lasers.B.Enabled = true
		Lasers.C.Enabled = true
		debounce = false

tween1 makes the button push in, and tween2 makes the button push back out to simulate a pressing button animation.

The elseif is in the wrong place, it is connected to the player.teamcolor “if” statement. You can move the end that is before the elseif to the end of the function

1 Like