Moon's Main Menu UI

Try this:

-- Let's Define a Few Important Variables first!
local button = script.Parent -- We define our button, which is a child to this script.
local description = button:WaitForChild("Description") -- Get's the description thats inside the button.
local tweenService = game:GetService("TweenService") -- This allows us to do smooth animations!
local tweenInfo = TweenInfo.new(0.35, Enum.EasingStyle.Quad) -- This is the info for our tweens. The first Int is the duration of time (in seconds) it takes to finish a tween and the second Value is the EasingStyle. You can play around with both and see if you find something you like!


-- Now Let's program the button!
button.MouseEnter:Connect(function() -- The code inside this function occurs whenever the players mouse is over the button. Let's make some nice animations.
	tweenService:Create(description, tweenInfo, {TextTransparency = 0}):Play() -- Makes the description text visible.
	button:TweenSize(UDim2.new(0.209, 0, 0.057, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quad, 0.1, true) -- tweens the size of the button and makes it bigger
end)

button.MouseLeave:Connect(function() -- The code inside this function occurs whenever the players mouse is over the button, but then leaves.
	tweenService:Create(description, tweenInfo, {TextTransparency = 1}):Play() -- Makes the description text invisible.
	button:TweenSize(UDim2.new(0.202, 0, 0.051, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quad, 0.1, true) -- tweens the size of the button and makes it the base size of what it was
end)

button.MouseButton1Click:Connect(function() -- The code inside this function occurs whenever the player clicks the button.
	local clickSFX = script.Parent.Parent.Click
	-- clickSFX:Play() -- OPTIONAL, UNCOMMENT IF YOU WANT A SOUND TO PLAY WHEN THE PLAYER CLICKS THE BUTTON.
	local CurrentCamera = workspace.CurrentCamera
CurrentCamera.CameraType = Enum.CameraType.Custom
	workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
    workspace.CurrentCamera.CFrame = game.Players.LocalPlayer.Character.Head.CFrame
	
end)

doesnt work.
image

2 Likes

This menu is awesome! I could create smth else with it like shown in the vid, I will prob make it a bit better and detailed in the future, but I’m happy with the result, nice resource!

7 Likes

Oh my god, I was just looking through the thread and I didn’t expect to see my LocationTitle module. Very cool to see the implementation! You should probably change it so it plays after the intro sequence and everything.

4 Likes

Yeah, I’m actually going to use it for some projects that I have, since it is much better than my old system, and it looks fancier, but sure, I will do your suggestion for sure!

1 Like

This is my take at it.

6 Likes


I can’t seem to find the problem here, I kept on checking the output but still can’t figure the problem out. It used to work but now it doesn’t.

try :WaitForChild(workspace.campart)


Still nothing. I don’t really have much knowledge in scripting, is this right? If then, what line?

undo whatever you just did and change line 3 to:
local camPart = workspace:WaitForChild("campart")

Very good, like the detail within it too!

Could I add some cool music to the main menu? If yes then could anyone help me out on what should I do? Thank you!

You could add a boolean that checks for whenever the player’s in the main menu. Call it isInMainMenu or something. While they’re in the main menu, set it to true then have a while loop run while it’s true. Then you could load your music in before the script.

local MainMenuMusic = (location of music here) -- Put in a WaitForChild here
local isInMainMenu = false 
-- insert gui code here
isInMainMenu = true 
while isInMainMenu do
   MainMenuMusic:Play()
end

Then when the player exits, set the boolean to false. Then the while loop (hopefully) will end.

do I insert your script into “TitleSceenHandler” ?
image

Yeah it should work when put into there

Hello, i checked your problem and it is the solution;
you can paste this script

-- Let's Define a Few Important Variables first!
local button = script.Parent -- We define our button, which is a child to this script.
local description = button:WaitForChild("Description") -- Get's the description thats inside the button.
local tweenService = game:GetService("TweenService") -- This allows us to do smooth animations!
local tweenInfo = TweenInfo.new(0.35, Enum.EasingStyle.Quad) -- This is the info for our tweens. The first Int is the duration of time (in seconds) it takes to finish a tween and the second Value is the EasingStyle. You can play around with both and see if you find something you like!


-- Now Let's program the button!
button.MouseEnter:Connect(function() -- The code inside this function occurs whenever the players mouse is over the button. Let's make some nice animations.
	tweenService:Create(description, tweenInfo, {TextTransparency = 0}):Play() -- Makes the description text visible.
	button:TweenSize(UDim2.new(0.209, 0, 0.057, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quad, 0.1, true) -- tweens the size of the button and makes it bigger
end)

button.MouseLeave:Connect(function() -- The code inside this function occurs whenever the players mouse is over the button, but then leaves.
	tweenService:Create(description, tweenInfo, {TextTransparency = 1}):Play() -- Makes the description text invisible.
	button:TweenSize(UDim2.new(0.202, 0, 0.051, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quad, 0.1, true) -- tweens the size of the button and makes it the base size of what it was
end)

button.MouseButton1Click:Connect(function() -- The code inside this function occurs whenever the player clicks the button.
	local clickSFX = script.Parent.Parent.Click
	-- clickSFX:Play() -- OPTIONAL, UNCOMMENT IF YOU WANT A SOUND TO PLAY WHEN THE PLAYER CLICKS THE BUTTON.
	local CurrentCamera = workspace.CurrentCamera
CurrentCamera.CameraType = Enum.CameraType.Custom
	workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
    workspace.CurrentCamera.CFrame = game.Players.LocalPlayer.Character.Head.CFrame

-- This is the solution
script.Parent.Parent.Parent.CameraMovement.Enabled = false
	
end)

at the end, you must disable the CameraMovement script.

1 Like

Does anyone know how I would script the New Game to get rid of the GUI and force them into first person? I’ve tried by looking at other scripts but I have no experience

1 Like

I haven’t used it, but I think it will go like:
(MAKE SURE THIS IS A LOCALSCRIPT)

--insert your get rid of gui code here
local plr = game.Players.LocalPlayer
local start = game.StarterPlayer

start.CameraMaxZoomDistance = 0.5

{Correct me if I’m wrong, new to scripting and I didn’t try this.}

1 Like

Thanks for replying so soon! I’ll try it out as soon as possible

Even after adding the script and removing the GUI the camera still appears to be fixed in place to where the camera part is

button.MouseButton1Click:Connect(function() -- The code inside this function occurs whenever the player clicks the button.
	local clickSFX = script.Parent.Parent.Click
	local plr = game.Players.LocalPlayer
	local start = game.StarterPlayer

	local Players = game:GetService("Players")

	local player = Players.LocalPlayer
	
	start.CameraMaxZoomDistance = 0.5

	player.CameraMode = Enum.CameraMode.LockFirstPerson
	
	
	script.Parent.Parent.Parent.CameraMovement:Destroy()
	workspace.campart:Destroy()
	workspace.CurrentCamera:Destroy()
	script.Parent.Parent:Destroy()
	-- clickSFX:Play() -- OPTIONAL, UNCOMMENT IF YOU WANT A SOUND TO PLAY WHEN THE PLAYER CLICKS THE BUTTON.
	-- YOUR CODE HERE -- 
end)

This is the code btw i know its very messy sorry