I created a tween so that when a player clicks the quick play button, the main menu will tween out of the screen. However, when the button is clicked, nothing happens. Anyone know how to fix this? Thanks!
Script:
local player = game:GetService("Players").LocalPlayer
local TweenService = game:GetService("TweenService")
local mainMenuFrame = player.PlayerGui:WaitForChild("MainMenu")
local TweenInformation = TweenInfo.new(1, Enum.EasingStyle.Linear)
local goal = {
Position = UDim2.new(0, -50, 0, 75)
}
local goal2 = {
Position = UDim2.new(0, 50, 0, 75)
}
local playTween = TweenService:Create(mainMenuFrame, TweenInformation, goal)
mainMenuFrame.QuickPlay.ClickDetector.MouseClick:Connect(function()
playTween:Play()
end)
Your ‘mainMenuFrame’ variable refers to the ScreenGui, not the frame. Also just use .Activated for gui buttons. Hopefully this works:
local player = game:GetService("Players").LocalPlayer
local TweenService = game:GetService("TweenService")
local mainMenuFrame = player.PlayerGui:WaitForChild("MainMenu").MenuFrame
local TweenInformation = TweenInfo.new(1, Enum.EasingStyle.Linear)
local goal = {
Position = UDim2.new(0, -50, 0, 75)
}
local goal2 = {
Position = UDim2.new(0, 50, 0, 75)
}
local playTween = TweenService:Create(mainMenuFrame, TweenInformation, goal)
mainMenuFrame.QuickPlay.Activated:Connect(function()
playTween:Play()
end)