Main Menu Scripting problem

You can write your topic however you want, but you need to answer these questions:
Hello just getting started with programming
I tried to make Main Menu together with this video

I got to the popups element and Stuck with the program nothing works. I don’t know if it’s okay to ask questions like this or if they are on another category but please help


I am here

local buttons = script.Parent.Parent.Parent.Parent.Parent.BUTTONS
local popups = buttons.Parent.Popups

script.Parent.MouseButton1Click:Connect(function()
	
	popups.Credits:TweenPosition(UDim2.new(0, 0,0.1, 0)"InOut", "Quad", 1, true)
	


	wait(1)
	
	buttons.PLAY.TextButton.LocalScript.Enabled = true
	buttons.UPDATE.TextButton.LocalScript.Enabled = true
	buttons.CREDIT.TextButton.LocalScript.Enabled = true

	buttons:TweenPosition(UDim2.new(0.399, 0,671, 0), "InOut", "Quad",1, true)
	buttons.Parent.Title:TweenPosition(UDim2.new(0.385, 0,143, 0), "InOut", "Quad",1, true)
end)

this is for close button
and in all of them there is an animation script

local tweenservice = game:GetService("TweenService")
local  info1 = TweenInfo.new(0.1, Enum.EasingStyle.Quad,Enum.EasingDirection.InOut)

script.Parent.MouseEnter:Connect(function()
	tweenservice:Create(script.Parent, info1, {BackgroundColor3 = Color3.fromRGB(50,50,50)}):Play()
end)

script.Parent.MouseLeave:Connect(function()
	tweenservice:Create(script.Parent, info1, {BackgroundColor3 = Color3.fromRGB(40,40,40)}):Play()
end)

I don’t know what I did wrong
I’m reviewing the same video over and over again and can’t figure it out

I know it’s a silly request but I’ve been thinking about it long enough
and I can’t figure it out and I’ve only been learning lua for a short time

2 Likes

add a coma before ‘InOut’, let me know if it worked :))

2 Likes

There are multiple grammatical errors in your code like the one @pazdanmichal2 talked about. They are the following:

  1. Animation script Extra space used when defining variable:
local  info1 = TweenInfo.new(0.1, Enum.EasingStyle.Quad,Enum.EasingDirection.InOut)

Replacement:

local info1 = TweenInfo.new(0.1, Enum.EasingStyle.Quad,Enum.EasingDirection.InOut)
  1. Close button Missing comma in :TweenPosition arguments:
popups.Credits:TweenPosition(UDim2.new(0, 0,0.1, 0)"InOut", "Quad", 1, true)

Replacement:

popups.Credits:TweenPosition(UDim2.new(0, 0,0.1, 0), "InOut", "Quad", 1, true)

There are also some other things I would recommend to optimize your script for performance and readability:

  1. Replace wait() with task.wait()
  2. Remove extra, unreasonable spaces, like these in the close button script:
	popups.Credits:TweenPosition(UDim2.new(0, 0,0.1, 0)"InOut", "Quad", 1, true)
	


	wait(1)

Hope this helped! If this doesn’t work, tell me and I’ll help you work it out.
Fizzitix

2 Likes

I am very sorry but in the subject post I forgot to add the Credits opening script
I was tired yesterday and didn’t notice

local popups = script.Parent.Parent.Parent.Parent.Popups
local buttons = script.Parent.Parent.Parent

script.Parent.MouseButton1Click:Connect(function()
	buttons.PLAY.TextButton.LocalScript.Enabled = false
	buttons.UPDATE.TextButton.LocalScript.Enabled = false
	buttons.CREDIT.TextButton.LocalScript.Enabled = false
	
	buttons:TweenPosition(UDim2.new(0.399, 0,1, 0), "InOut", "Quad",1, true)
	buttons.Parent.Title:TweenPosition(UDim2.new(0.385, 0,-0.2, 0), "InOut", "Quad",1, true)
	
	wait(1)
	
	popups.Credits:TweenPosition(UDim2.new(0, 0,0.015, 0)"InOut", "Quad", 1, true)
end)

is there a possibility that I have confused the position?
popups simply do not open

1 Like

I strongly suggest changing this. I hate the idea of changing the Enabled (or Disabled) property of scripts for functionality, as it’s inefficient and non-modular.

1 Like

again comma is missing for this line, it’s expecting you to add it.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.