It has an error when i play the game With 2 Players and i'm not sure why Here's The Code

game.Players.LocalPlayer.PlayerGui.InventoryGui.Inventory2.MouseButton1Click:connect(function()

----------Open
	
	
	print("rgdr")
	game.Players.LocalPlayer.PlayerGui.InventoryGui.Frame.Visible = true
	


---------Spawn Plane




game.Players.LocalPlayer.PlayerGui.InventoryGui.Frame.SpawnPlane.MouseButton1Click:connect(function()
	
	
	----What Will Happen When you Spawn The Plane
	
	
	
	

end)





-----CLOSE


if game.Players.LocalPlayer.PlayerGui.InventoryGui.Frame.Visible == true then
	
	game.Players.LocalPlayer.PlayerGui.InventoryGui.Frame.Close.MouseButton1Click:connect(function()
		
		game.Players.LocalPlayer.PlayerGui.InventoryGui.Frame.Visible = false
		
	end)
end

end

3 comments

0

it appears you need a delay. I believe it is trying to find the "Inventory2" gui before it has been loaded.

0

Yup. Try using :WaitForChild()

0

OMG OMG YOU ARE SO SMART IT WORKS I HAVE BEN TRYING TO FIX ALL DAY TY TY TY SO MUCH