Im new to scripting and I’m messing around and i decided to try to get a part to turn semi transparent and red when i click the “Button” (the part w/ Click detector). I figured that out but im wondering how i could change it back to solid and a new color by clicking it a second time. This is my current code
script.Parent.Parent.Click.ClickDetector.MouseClick:Connect(function()
local TweenService = game:GetService("TweenService")
local TI = TweenInfo.new(1, 0, 1, 0, false, 2)
local TweenProperties = {Transparency = 0.5; Color = Color3.new(1, 0, 0)}
local Tween = TweenService:Create(script.Parent, TI, TweenProperties)
Tween:Play()
end)
script.Parent.Parent.Click.ClickDetector.MouseClick:Connect(function()
local TweenService = game:GetService("TweenService")
local TI = TweenInfo.new(1, 0, 1, 0, false, 1)
local TweenProperties = {Transparency = 0; Color = Color3.new(0.619608, 1, 0.937255)}
local Tween = TweenService:Create(script.Parent, TI, TweenProperties)
Tween:Play()
end)
I know the problem is the code is only seeing the first code block when i click and triggers that and doesnt get to the second click, how could i fix this?
pictures: