Hello! I am making a Gui so that when Someone joins my game, A gui pops up with an ImageLabel and a ImageButton. The button is supposed to remove the Gui.
This is what I have so far; Note that nothing happens in the StarterGui and nothing happens in the Output.
function onPlayerEntered(player)
Sg = Instance.new("ScreenGui", game.StarterGui)
Fr = Instance.new("Frame", Sg)
Fr.Size = UDim2(0,100, 0,100)
Fr.Position = UDim2(0,0, 0,0)
Fr.BackroundTransparency = 1
Il = Instance.new("ImageLabel", Fr)
Il.size = UDim2(7,100, 4,100)
Il.Position = UDim2(0.7,0, 0.4,0)
Il.Image = "rbxassetid://184730943"
Fr1 = Instance.new("Frame",Sg)
Fr1.Size = UDim2(0,100, 0,100)
Fr1.Position = UDim2(0,0, 0,0)
Fr1.BackroundTransparency = 1
Il1 = Instance.new("ImageButton",Fr1)
Il1.size = UDim2(-0.5,100, -0.5,100)
Il1.Position = UDim2(9.19,0, 0.4,0)
Il1.Image = "rbxassetid://65415651"
Il1.MouseButton1Click:connect(function()
Game.StarterGui.ScreenGui.Remove
end)
onPlayerEntered:Connect(player)
Any solutions?

3 comments
Okay, this works, However when I click on the Button that is supposed to destroy it, nothing happens. IN the Output it says "Attempt To Call Nil Value" Any help?
I'll help with this one. MrSmenry forgot an important factor. On line 20, change 'game.StarterGui' to 'player.PlayerGui'. You should also do that on line 2 to make it more efficient.
This made the entire script not work. Sorry.