Hi, I was scripting a button and to animate a frame, but when i tried to test, it always go to corner of screen.
I even tried looking at developer hub but it didnt work, also here the script:
local GOAL_POSISTION = UDim2.new(0.55, 0,0.525, 0)
local GOAL_POSISTION2 = UDim2.new(0.337, 0,0.947, 0)
local SoundService = game:GetService("SoundService")
local cooldown = 0.25
local MainFrame = script.Parent.Parent.Parent
local function checkVisible(i) if MainFrame:FindFirstChild(i).Visible == true then return true; else return false; end end
local function ChangeStateGlobal()
if MainFrame:FindFirstChild("Settings").Visible == true then
MainFrame:FindFirstChild("Settings"):TweenPosition(GOAL_POSISTION, Enum.EasingDirection.In, Enum.EasingStyle.Quad, cooldown)
task.wait(cooldown)
MainFrame:FindFirstChild("Settings").Visible = false
elseif MainFrame:FindFirstChild("GamepassShop").Visible == true then
MainFrame:FindFirstChild("GamepassShop"):TweenPosition(GOAL_POSISTION, Enum.EasingDirection.In, Enum.EasingStyle.Quad, cooldown)
task.wait(cooldown)
MainFrame:FindFirstChild("GamepassShop").Visible = false
end
end
script.Parent.MouseButton1Click:Connect(function()
MainFrame.Credits.Visible = true
SoundService.ButtonEffects.ClickingSound:Play()
MainFrame.Credits:TweenPosition(UDim2.new({0.55, 0},{0.525, 0}), Enum.EasingDirection.In, Enum.EasingStyle.Quad, cooldown)
local WelcomeCheck = checkVisible('Welcome')
if WelcomeCheck then
MainFrame.Credits.Visible = false
SoundService.ButtonEffects.ClickingSound:Stop()
SoundService.ButtonEffects.ErrorSound:Play()
MainFrame.ErrorMessage.Visible = true
task.wait(2)
MainFrame.ErrorMessage.Visible = false
end
ChangeStateGlobal()
end)
and no, it didnt error in the exit.
If you found a solution, please tell in the comments!
by darkmenacing