I am trying to create a main menu using tweening and animations. I am running it from two scripts, and these scripts are supposed to enable/disable each other. Here are the scripts it will probably make a lot more sense what I’m trying to do if I just show you. Also a video will be attached showing what my problem is. Output shows nothing unusual.
VIDEO:
Script 1: This is essentially when the Buttons are in the normal form (with play in the middle)
local TweenService = game:GetService('TweenService')
local Up = script.Parent.ArrowUp
local Down = script.Parent.ArrowDown
local play = script.Parent.Play
local cm = script.Parent.Customize
local sm = script.Parent.StoryMode
if Up.TextTransparency == 0 and Down.TextTransparency == 0 then
script.Parent.ButtonSwitch2.Enabled = false
end
Up.MouseButton1Up:Connect(function()
play:TweenPosition(UDim2.new(0.116, 0,0.611, 0), "Out", "Sine", 0.5, false
)
play:TweenSize(UDim2.new(0.113, 0, 0.077, 0), "Out", "Sine", 0.5, false
)
sm:TweenPosition(UDim2.new(0.097, 0, 0.448, 0), "Out", "Sine", 0.5, false
)
sm:TweenSize(UDim2.new(0.152, 0, 0.104, 0), "Out", "Sine", 0.5, false
)
cm:TweenPosition(UDim2.new(0.157, 0, 0.668, 0), "Out", "Sine", 0.1, false
)
cm:TweenSize(UDim2.new(0.046, 0, 0.022, 0), "Out", "Sine", 0.1, false
)
play.TextTransparency = 0.25
sm.TextTransparency = 0
Up.TextTransparency = 1
cm.TextTransparency = 1
end)
Down.MouseButton1Up:Connect(function()
play:TweenPosition(UDim2.new(0.116, 0, 0.325, 0), "Out", "Sine", 0.5, false
)
play:TweenSize(UDim2.new(0.113, 0, 0.077, 0), "Out", "Sine", 0.5, false
)
cm:TweenPosition(UDim2.new(0.097, 0, 0.448, 0), "Out", "Sine", 0.5, false
)
cm:TweenSize(UDim2.new(0.152, 0, 0.104, 0), "Out", "Sine", 0.5, false
)
sm:TweenPosition(UDim2.new(0.157, 0, 0.287, 0), "Out", "Sine", 0.1, false
)
sm:TweenSize(UDim2.new(0.046, 0, 0.022, 0), "Out", "Sine", 0.1, false
)
play.TextTransparency = 0.25
cm.TextTransparency = 0
Down.TextTransparency = 1
wait(0.1)
sm.TextTransparency = 1
end)
Script 2: This script essentially is when the buttons aren’t in normal form, and I want them to return to their original positions when respective button is pressed.
local TweenService = game:GetService('TweenService')
local Up = script.Parent.ArrowUp
local Down = script.Parent.ArrowDown
local play = script.Parent.Play
local cm = script.Parent.Customize
local sm = script.Parent.StoryMode
if Up.TextTransparency == 1 then
script.Parent.ButtonSwitch.Enabled = false
Down.MouseButton1Up:Connect(function()
play:TweenPosition(UDim2.new(0.097, 0, 0.448, 0), "Out", "Sine", 0.5, false
)
play:TweenSize(UDim2.new(0.152, 0, 0.448, 0), "Out", "Sine", 0.5, false
)
cm:TweenPosition(UDim2.new(0.116, 0, 0.611, 0), "Out", "Sine", 0.5, false
)
cm:TweenSize(UDim2.new(0.113, 0, 0.077, 0), "Out", "Sine", 0.5, false
)
sm:TweenPosition(UDim2.new(0.116, 0, 0.325, 0), "Out", "Sine", 0.5, false
)
sm:TweenSize(UDim2.new(0.113, 0, 0.077, 0), "Out", "Sine", 0.5, false
)
Down.TextTransparency = 0
Up.TextTransparency = 0
sm.TextTransparency = 0.25
cm.TextTransparency = 0.25
play.TextTransparency = 0
end)
end
if Down.TextTransparency == 1 then
script.Parent.ButtonSwitch.Enabled = false
Up.MouseButton1Up:Connect(function()
play:TweenPosition(UDim2.new(0.097, 0, 0.448, 0), "Out", "Sine", 0.5, false
)
play:TweenSize(UDim2.new(0.152, 0, 0.448, 0), "Out", "Sine", 0.5, false
)
cm:TweenPosition(UDim2.new(0.116, 0, 0.611, 0), "Out", "Sine", 0.5, false
)
cm:TweenSize(UDim2.new(0.113, 0, 0.077, 0), "Out", "Sine", 0.5, false
)
sm:TweenPosition(UDim2.new(0.116, 0, 0.325, 0), "Out", "Sine", 0.5, false
)
sm:TweenSize(UDim2.new(0.113, 0, 0.077, 0), "Out", "Sine", 0.5, false
)
Down.TextTransparency = 0
Up.TextTransparency = 0
sm.TextTransparency = 0.25
cm.TextTransparency = 0.25
play.TextTransparency = 0
end)
end
Hopefully, I properly explained what I’m trying to do. Any help I can get would be awesome. If I didn’t explain what I’m trying to do properly, please ask questions! PS: Ignore my buggy camera script I plan on fixing that lol. Also I know I could have used TweenSizeAndPosition but i didnt feel like it. If i should genuinely change that pls lmk tho!