Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why my menuGui doesnt close when i press play ?

Asked by 3 years ago
Edited 3 years ago

Please encode Lua code in the Lua block code tag (look for the Lua icon in the editor).

Hello, I was coding my menu following a tutorial and so far everything was working fine, but at the time of the test, I noticed that you cannot exit the menu, when you press "play" , the music stops well but the menu and the blur do not disappear... Thanks in advance ! ps: if someone could also tell me how to put another gui after the menu is gone? that would be nice :)

Script :

local player = game.Players.LocalPlayer
local character = player.CharacterAdded
local Mouse = player:GetMouse()
local camera = game.Workspace.CurrentCamera

local defaultCframe = camera.CFrame
local view = 150
local blur = game.Lighting.Blur

blur.Size = 20

print "Start menu ok"

function updateCamera()
    camera.CFrame = game.Workspace.MenuCamera.CFrame
end
print "Update camera ok"

game:GetService("RunService").RenderStepped:Connect(updateCamera)

print "GetService ok"

script.Parent.Frame.Play.MouseButton1Click:Connect(function()
    wait(0.2)
    game.Workspace.MenuMusic:Stop()
    camera.CameraType = Enum.CameraType.Custom
    script:Destroy()
    script.Parent.Frame:Destroy()
    script:Destroy()

end)
0
Can't read this, put it into a code block. TheB4dComputer 100 — 3y
0
I edited the script into code block :) kiki3ss 0 — 3y
0
I think its because you destroyed the script before destroying the frame. When the script it destroyed, the rest of the code might not run. JustinWe12 723 — 3y

Answer this question