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?
function onPlayerEntered(player) Sg = Instance.new("ScreenGui", game.StarterGui) Fr = Instance.new("Frame", Sg) Fr.Size = UDim2.new(0,100, 0,100) Fr.Position = UDim2.new(0,0, 0,0) Fr.BackroundTransparency = 1 Il = Instance.new("ImageLabel", Fr) Il.size = UDim2.new(7,100, 4,100) Il.Position = UDim2.new(0.7,0, 0.4,0) Il.Image = "rbxassetid://184730943" Fr1 = Instance.new("Frame",Sg) Fr1.Size = UDim2.new(0,100, 0,100) Fr1.Position = UDim2.new(0,0, 0,0) Fr1.BackroundTransparency = 1 Il1 = Instance.new("ImageButton",Fr1) Il1.Size = UDim2.new(-0.5,100, -0.5,100) Il1.Position = UDim2.new(9.19,0, 0.4,0) Il1.Image = "rbxassetid://65415651" Il1.MouseButton1Click:connect(function() Game.StarterGui.ScreenGui:Destroy() end) end) game.Players.PlayerAdded:connect(onPlayerEntered(player))
solution one: just make the gui from the actual frame n stuff, it will be a lot easier.
game.Players.PlayerAdded:connect(function(Plr) Sg = Instance.new("ScreenGui", Plr:WaitForChild('PlayerGui')) 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() Sg:remove() end)