My gui is not showing up when the button is clicked its part of a save script. Everything is in the correct position.

function loadScore(plyr, clickCounter)

	local score = plyr:LoadNumber("Stage") 

	if not score == 0 then
		clickCounter.Value = score
	else
		print("Nothing to load../..score was 0")
	end

end



function onClicked(Player)

	player = script.Parent.Parent.Parent.Parent.Parent
		player:WaitForDataReady()
if player.DataReady == true then
		loadScore(player, player.leaderstats:findFirstChild(script.Parent.Parent.Parent.Configuration.Type.Value))
		player.leaderstats:findFirstChild(script.Parent.Parent.Parent.Configuration.Type.Value).Value = player:LoadNumber("Stage")
**m = game.Lighting.Loading
m:Clone().Parent = Player.PlayerGui**

			script.Parent.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0
		game:service("Debris"):AddItem(m, 3)
	else
**	m = game.Lighting.Extra
	m:Clone().Parent = Player.PlayerGui**
		game:service("Debris"):AddItem(m, 3)
	end
end 

script.Parent.MouseButton1Click:connect(onClicked)

7 comments

0

I just deleted this comment, but I take it back actually... https://scriptinghelpers.org/blog/common-mistakes#GuiEvent Also, why so you have ** ** throughout the code, were you just having trouble formatting your question properly?

0

I thought it would make it bold because the thing said bold and thats where i wanted the help

0

also this isn't a urface gui ??

0

Doesn't necessarily work with the code block. The code block on this site works like may other code blocks on many other sites. Whatever you put in the code block does not get recognized by the HTML as a command however just displays the content of it. Use -- for comments instead.

0

The common mistake I linked you to uses surface guis as an example, however your problem is still the same indicated by the Common Mistakes blog article.

0

but how would i make it go to the players playergui?

0

Where the heck are you getting the PlayerAdded function from? The section of the blog article simply states that you can't get the player from the MouseButton1Clicked event, and for client interaction with a Gui you must have the Gui in the PlayerGui and adorned to the part. You have the choice between Local or Server Script, however, it is always recommended to use LocalScripts when modifying Gui