Gui not closing

Add a print statement in the onClick function.

1 Like

allright will do :slight_smile:

yeah its firing the on click :smiley:

Can you send me a picture of the layout of your guis.

here image

This should disabled the MainGui

local function onClick()
	local players = game:GetService("Players")
	local player = players.LocalPlayer

	for i = 1, 0, -0.1 do

		script.Parent.Parent.Parent.Music.Volume = i
		wait(0.07)
	end

	script.Parent.Parent.Parent.Music:Stop()
	player.Character.Humanoid.Health = 0
    wait(5)
    script.Parnet.Parent.Parent.Enabled = false
end

script.Parent.MouseButton1Click:Connect(onClick)
script.Parent.PlayButton.MouseButton1Click:Connect(onClick)

nope i still have it odd :thinking:

Tell me what it prints.

local function onClick()
	local players = game:GetService("Players")
	local player = players.LocalPlayer

	for i = 1, 0, -0.1 do

		script.Parent.Parent.Parent.Music.Volume = i
		wait(0.07)
	end

	script.Parent.Parent.Parent.Music:Stop()
	player.Character.Humanoid.Health = 0
    wait(5)
    script.Parnet.Parent.Parent.Enabled = false
    print(script.Parnet.Parent.Parent.Enabled) -- What does this print
end

script.Parent.MouseButton1Click:Connect(onClick)
script.Parent.PlayButton.MouseButton1Click:Connect(onClick)

20:00:53.340 Script ‘Players.justhatsav.PlayerGui.MenuGui.MainMenu.Play.OnClick’, Line 14 - function onClick - Studio - OnClick:14

This should print the MainGui. Tell me if it prints something else

local function onClick()
	local players = game:GetService("Players")
	local player = players.LocalPlayer

	for i = 1, 0, -0.1 do

		script.Parent.Parent.Parent.Music.Volume = i
		wait(0.07)
	end

	script.Parent.Parent.Parent.Music:Stop()
	player.Character.Humanoid.Health = 0
    print(script.Parnet.Parent.Parent)
end

script.Parent.MouseButton1Click:Connect(onClick)
script.Parent.PlayButton.MouseButton1Click:Connect(onClick)

20:08:01.848 Script ‘Players.justhatsav.PlayerGui.MenuGui.MainMenu.Play.OnClick’, Line 15 - function onClick - Studio - OnClick:15

What is on the line that errors?

non it all looks fine there is no red line

Whats the code on the line I mean.

14 and 15 it seams :thinking: odd

Whats the code on line 14 and 15 for you.

local function onClick()
	local players = game:GetService("Players")
	local player = players.LocalPlayer

	for i = 1, 0, -0.1 do

		script.Parent.Parent.Parent.Music.Volume = i
		wait(0.07)
	end

	script.Parent.Parent.Parent.Music:Stop()
	player.Character.Humanoid.Health = 0
    print(script.Parnet.Parent.Parent)
end

script.Parent.PlayButton.MouseButton1Click:Connect(onClick)

try this

the gui still stays the same even when the player dies too

local function onClick()
	local players = game:GetService("Players")
	local player = players.LocalPlayer

	for i = 1, 0, -0.1 do

		script.Parent.Parent.Parent.Music.Volume = i
		wait(0.07)
	end

	script.Parent.Parent.Parent.Music:Stop()
	player.Character.Humanoid.Health = 0
    script.Parnet.Parent.Parent.Enabled = false
end

script.Parent.PlayButton.MouseButton1Click:Connect(onClick)

can you try it too

yeah still nothing im confused