I’ve been making a script for Animations that I could apply to my Gui but something doesn’t work. I’ve searched everything: DevForum, ChatGPT ( You could never know ), Internet, etc…
I noticed that the Values for VISIBLE and DEBOUNCE never Changed.
And I don’t know why that is happening!
Here are the Values after clicking the Button multiple times:
Any help is appreciated
Here is the Script:
-- Services
local PLAYERS = game:GetService("Players")
local TWEENSERVICE = game:GetService("TweenService")
local RP = game:GetService("ReplicatedStorage")
-- Variables
local GUI = script.Parent
local MAIN_FRAME = GUI:WaitForChild("Main")
local BUTTONS_HOLDER = MAIN_FRAME:WaitForChild("ButtonsHolder")
local TOGGLE = MAIN_FRAME:WaitForChild("Toggle")
-- (Folders)
local SOZNDS = GUI:WaitForChild("Sounds")
local MODULES = GUI:WaitForChild("Modules")
-- Modules
local TWEENMODULE = require(MODULES:WaitForChild("UIFeatures"))
-- Tables
local CURRENT_DEBOUNCES = {
["TOGGLE"] = false
}
local CURRENT_VISIBLE = {
["MAIN_FRAME"] = false
}
-- Functions
local function TWEEN_TOGGLE_UP_DOWN(INSTANCE, VISIBLE, DEBOUNCE)
if DEBOUNCE then return end
local TI = TweenInfo.new(.2, Enum.EasingStyle.Circular, Enum.EasingDirection.InOut)
if VISIBLE then
DEBOUNCE = true
local TWEEN = TWEENSERVICE:Create(INSTANCE, TI, {Position = UDim2.new(.5, 0, 0.9, 0)})
TWEEN:Play()
TWEEN.Completed:Wait()
VISIBLE = not VISIBLE
DEBOUNCE = false
return
else
DEBOUNCE = true
local TWEEN = TWEENSERVICE:Create(INSTANCE, TI, {Position = UDim2.new(.5, 0, 1.06, 0)})
TWEEN:Play()
TWEEN.Completed:Wait()
VISIBLE = not VISIBLE
DEBOUNCE = false
return
end
end
-- TODO: Make Hover Animation
TOGGLE.MouseButton1Click:Connect(function()
TWEEN_TOGGLE_UP_DOWN(MAIN_FRAME, CURRENT_VISIBLE.MAIN_FRAME, CURRENT_DEBOUNCES.TOGGLE)
end)
You simply forgot to make all the appropriate changes.
-- This function is called with (MAIN_FRAME, "MAIN_FRAME", "TOGGLE")
local function TWEEN_TOGGLE_UP_DOWN(INSTANCE, VISIBLE, DEBOUNCE)
-- DEBOUNCE will always be "TOGGLE",
-- meaning the function will return.
if DEBOUNCE then return end
-- We should do
if CURRENT_DEBOUNCES[DEBOUNCE] then return end
-- instead.
end