Trying to make a main menu (which I have successfully done), the problem is, I tried to make it so that when the player clicks the play button, it has this cool transition where the camera fades to black, then fades back to where everything is visible.
Here’s the script:
local player = game.Players.LocalPlayer
local char = player.CharacterAdded
local mouse = player:GetMouse()
local cam = game.Workspace.CurrentCameralocal defaultcf = cam.CFrame
local view = 150
local blur = game.Lighting.Blurblur.Size = 6
game.Workspace.AMBIENCE:Stop()
function updatecam()
cam.CFrame = game.Workspace.MenuCam.CFrameend
local transframe = game.StarterGui.TRANSITION.Framegame:GetService(“RunService”).RenderStepped:Connect(updatecam)
script.Parent.Frame.PLAY.MouseButton1Click:Connect(function()
local transframe = game.StarterGui.TRANSITION.Frame
wait(.2)
blur.Size = 0
game.Workspace.MENUMUSIC:Stop()
game.Workspace.AMBIENCE:Play()while true do
wait(.01)
transframe.BackgroundTransparency = transframe.BackgroundTransparency - .01if transframe.BackgroundTransparency == 0 then break end
end
wait(.5)
cam.CameraType = Enum.CameraType.Custom
script.Parent.Frame:Destroy()while true do
wait(.01)
transframe.BackgroundTransparency = transframe.BackgroundTransparency + .01if transframe.BackgroundTransparency == 1 then break end
end
script:Destroy()
end)